mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
348 lines
24 KiB
Diff
348 lines
24 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Fri, 11 Jul 2025 21:47:45 +0300
|
|
Subject: [PATCH] Linear region file format
|
|
|
|
|
|
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java b/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java
|
|
index a814512fcfb85312474ae2c2c21443843bf57831..215d4444fbd9821811fbd4724de088dbb589f179 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java
|
|
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java
|
|
@@ -8,9 +8,9 @@ public interface ChunkSystemRegionFileStorage {
|
|
|
|
public boolean moonrise$doesRegionFileNotExistNoIO(final int chunkX, final int chunkZ);
|
|
|
|
- public RegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ);
|
|
+ public org.bxteam.divinemc.region.IRegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ); // DivineMC - Buffered Linear region format
|
|
|
|
- public RegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException;
|
|
+ public org.bxteam.divinemc.region.IRegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException; // DivineMC - Buffered Linear region format
|
|
|
|
public MoonriseRegionFileIO.RegionDataController.WriteData moonrise$startWrite(
|
|
final int chunkX, final int chunkZ, final CompoundTag compound
|
|
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
|
index b83ccf7bbd134e97e14bfe8331cc9d2a26b9ec9c..a9ddee8c77ad653cd7875dc96797191750cc2781 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
|
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
|
@@ -1261,7 +1261,7 @@ public final class MoonriseRegionFileIO {
|
|
this.regionDataController.finishWrite(this.chunkX, this.chunkZ, writeData);
|
|
// Paper start - flush regionfiles on save
|
|
if (this.world.paperConfig().chunks.flushRegionsOnSave) {
|
|
- final RegionFile regionFile = this.regionDataController.getCache().moonrise$getRegionFileIfLoaded(this.chunkX, this.chunkZ);
|
|
+ final org.bxteam.divinemc.region.IRegionFile regionFile = this.regionDataController.getCache().moonrise$getRegionFileIfLoaded(this.chunkX, this.chunkZ); // DivineMC - Buffered Linear region format
|
|
if (regionFile != null) {
|
|
regionFile.flush();
|
|
} // else: evicted from cache, which should have called flush
|
|
@@ -1477,7 +1477,7 @@ public final class MoonriseRegionFileIO {
|
|
|
|
public static interface IORunnable {
|
|
|
|
- public void run(final RegionFile regionFile) throws IOException;
|
|
+ public void run(final org.bxteam.divinemc.region.IRegionFile regionFile) throws IOException; // DivineMC - Buffered Linear region format
|
|
|
|
}
|
|
}
|
|
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java b/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java
|
|
index 51c126735ace8fdde89ad97b5cab62f244212db0..23f6ed26b531ea570fdf2ae48c1e2710e0ed22ed 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java
|
|
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java
|
|
@@ -3,10 +3,10 @@ package ca.spottedleaf.moonrise.patches.chunk_system.storage;
|
|
import net.minecraft.world.level.chunk.storage.RegionFile;
|
|
import java.io.IOException;
|
|
|
|
-public interface ChunkSystemChunkBuffer {
|
|
+public interface ChunkSystemChunkBuffer {
|
|
public boolean moonrise$getWriteOnClose();
|
|
|
|
public void moonrise$setWriteOnClose(final boolean value);
|
|
|
|
- public void moonrise$write(final RegionFile regionFile) throws IOException;
|
|
+ public void moonrise$write(final org.bxteam.divinemc.region.IRegionFile regionFile) throws IOException; // DivineMC - Buffered Linear region format
|
|
}
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
|
index 3ea69f961797e390aabb697ad9a7f007e549d04d..30fb5b93ebb4b5f21c64f6589c33496df5242b1d 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -933,10 +933,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
// CraftBukkit end
|
|
if (flush) {
|
|
for (ServerLevel serverLevel : this.getAllLevels()) {
|
|
- LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", serverLevel.getChunkSource().chunkMap.getStorageName());
|
|
+ LOGGER.info("ThreadedChunkStorage ({}): All chunks are saved", serverLevel.getChunkSource().chunkMap.getStorageName()); // DivineMC - Buffered Linear region format
|
|
}
|
|
|
|
- LOGGER.info("ThreadedAnvilChunkStorage: All dimensions are saved");
|
|
+ LOGGER.info("ThreadedChunkStorage: All dimensions are saved"); // DivineMC - Buffered Linear region format
|
|
}
|
|
|
|
return flag;
|
|
diff --git a/net/minecraft/util/worldupdate/WorldUpgrader.java b/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
index a55ae044386baa52f2c4388b4ae2f58a58469099..f6a1f524f03e8fb79c713baa94193b5946c90e83 100644
|
|
--- a/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
+++ b/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
@@ -75,7 +75,7 @@ public class WorldUpgrader implements AutoCloseable {
|
|
volatile int skipped;
|
|
final Reference2FloatMap<ResourceKey<Level>> progressMap = Reference2FloatMaps.synchronize(new Reference2FloatOpenHashMap<>());
|
|
volatile Component status = Component.translatable("optimizeWorld.stage.counting");
|
|
- static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$");
|
|
+ static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\\\"+ net.minecraft.world.level.chunk.storage.RegionFileStorage.getExtensionName() +"$"); // DivineMC - Buffered Linear region format
|
|
final DimensionDataStorage overworldDataStorage;
|
|
|
|
public WorldUpgrader(
|
|
@@ -272,7 +272,7 @@ public class WorldUpgrader implements AutoCloseable {
|
|
}
|
|
|
|
private static List<WorldUpgrader.FileToUpgrade> getAllChunkPositions(RegionStorageInfo regionStorageInfo, Path path) {
|
|
- File[] files = path.toFile().listFiles((directory, filename) -> filename.endsWith(".mca"));
|
|
+ File[] files = path.toFile().listFiles((directory, filename) -> filename.endsWith(net.minecraft.world.level.chunk.storage.RegionFileStorage.getExtensionName())); // DivineMC - Buffered Linear region format
|
|
if (files == null) {
|
|
return List.of();
|
|
} else {
|
|
@@ -285,7 +285,7 @@ public class WorldUpgrader implements AutoCloseable {
|
|
int i1 = Integer.parseInt(matcher.group(2)) << 5;
|
|
List<ChunkPos> list1 = Lists.newArrayList();
|
|
|
|
- try (RegionFile regionFile = new RegionFile(regionStorageInfo, file.toPath(), path, true)) {
|
|
+ try (org.bxteam.divinemc.region.IRegionFile regionFile = net.minecraft.world.level.chunk.storage.RegionFileStorage.createNew(regionStorageInfo, file.toPath(), path, true)) { // DivineMC - Buffered Linear region format
|
|
for (int i2 = 0; i2 < 32; i2++) {
|
|
for (int i3 = 0; i3 < 32; i3++) {
|
|
ChunkPos chunkPos = new ChunkPos(i2 + i, i3 + i1);
|
|
@@ -333,7 +333,7 @@ public class WorldUpgrader implements AutoCloseable {
|
|
|
|
protected abstract boolean tryProcessOnePosition(T chunkStorage, ChunkPos chunkPos, ResourceKey<Level> dimension);
|
|
|
|
- private void onFileFinished(RegionFile regionFile) {
|
|
+ private void onFileFinished(org.bxteam.divinemc.region.IRegionFile regionFile) { // DivineMC - Buffered Linear region format
|
|
if (WorldUpgrader.this.recreateRegionFiles) {
|
|
if (this.previousWriteFuture != null) {
|
|
this.previousWriteFuture.join();
|
|
@@ -438,7 +438,7 @@ public class WorldUpgrader implements AutoCloseable {
|
|
}
|
|
}
|
|
|
|
- record FileToUpgrade(RegionFile file, List<ChunkPos> chunksToUpgrade) {
|
|
+ record FileToUpgrade(org.bxteam.divinemc.region.IRegionFile file, List<ChunkPos> chunksToUpgrade) { // DivineMC - Buffered Linear region format
|
|
}
|
|
|
|
class PoiUpgrader extends WorldUpgrader.SimpleRegionStorageUpgrader {
|
|
diff --git a/net/minecraft/world/level/chunk/storage/RegionFile.java b/net/minecraft/world/level/chunk/storage/RegionFile.java
|
|
index ae0a893498d0bfe90c14508f15b431d4885e06ff..00656cf8634e06f7ce1067ef7ba44edfb4519be3 100644
|
|
--- a/net/minecraft/world/level/chunk/storage/RegionFile.java
|
|
+++ b/net/minecraft/world/level/chunk/storage/RegionFile.java
|
|
@@ -22,7 +22,7 @@ import net.minecraft.util.profiling.jfr.JvmProfiler;
|
|
import net.minecraft.world.level.ChunkPos;
|
|
import org.slf4j.Logger;
|
|
|
|
-public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.storage.ChunkSystemRegionFile { // Paper - rewrite chunk system
|
|
+public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.storage.ChunkSystemRegionFile, org.bxteam.divinemc.region.IRegionFile { // Paper - rewrite chunk system // DivineMC - Buffered Linear region format
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
public static final int MAX_CHUNK_SIZE = 500 * 1024 * 1024; // Paper - don't write garbage data to disk if writing serialization fails
|
|
private static final int SECTOR_BYTES = 4096;
|
|
@@ -912,7 +912,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche
|
|
}
|
|
|
|
@Override
|
|
- public final void moonrise$write(final RegionFile regionFile) throws IOException {
|
|
+ public final void moonrise$write(final org.bxteam.divinemc.region.IRegionFile regionFile) throws IOException { // DivineMC - Buffered Linear region format
|
|
regionFile.write(this.pos, ByteBuffer.wrap(this.buf, 0, this.count));
|
|
}
|
|
// Paper end - rewrite chunk system
|
|
diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
index 8215edb0dbb5a9de66d5107786c338d2fd02d5ea..954f1866176f28eb1bdee395130a60cfc7585c39 100644
|
|
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
@@ -19,7 +19,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper
|
|
public static final String ANVIL_EXTENSION = ".mca";
|
|
private static final int MAX_CACHE_SIZE = 256;
|
|
- public final Long2ObjectLinkedOpenHashMap<RegionFile> regionCache = new Long2ObjectLinkedOpenHashMap<>();
|
|
+ public final Long2ObjectLinkedOpenHashMap<org.bxteam.divinemc.region.IRegionFile> regionCache = new Long2ObjectLinkedOpenHashMap<>(); // DivineMC - Buffered Linear region format
|
|
private final RegionStorageInfo info;
|
|
private final Path folder;
|
|
private final boolean sync;
|
|
@@ -59,9 +59,29 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
private static final int MAX_NON_EXISTING_CACHE = 1024 * 4;
|
|
private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet nonExistingRegionFiles = new it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet();
|
|
private static String getRegionFileName(final int chunkX, final int chunkZ) {
|
|
- return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + ".mca";
|
|
+ return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + getExtensionName(); // DivineMC - Buffered Linear region format
|
|
}
|
|
|
|
+ // DivineMC start - Buffered Linear region format
|
|
+ public static org.bxteam.divinemc.region.IRegionFile createNew(RegionStorageInfo info, Path filePath, Path folder, boolean sync) throws IOException{
|
|
+ final org.bxteam.divinemc.region.EnumRegionFileExtension regionFormat = org.bxteam.divinemc.config.DivineConfig.MiscCategory.regionFileType;
|
|
+ final String fullFileName = filePath.getFileName().toString();
|
|
+ final String[] fullNameSplit = fullFileName.split("\\.");
|
|
+ final String extensionName = fullNameSplit[fullNameSplit.length - 1];
|
|
+
|
|
+ if (!regionFormat.getArgument().equalsIgnoreCase(extensionName)) {
|
|
+ net.minecraft.server.MinecraftServer.setFatalException(new RuntimeException("Invalid region file format: " + extensionName + " expected " + regionFormat.getArgument()));
|
|
+ throw new IOException("Invalid region file format: " + extensionName + " expected " + regionFormat.getArgument());
|
|
+ }
|
|
+
|
|
+ return regionFormat.getCreator().create(new org.bxteam.divinemc.region.RegionFileInfo(info, filePath, folder, sync));
|
|
+ }
|
|
+
|
|
+ public static String getExtensionName() {
|
|
+ return "." + org.bxteam.divinemc.config.DivineConfig.MiscCategory.regionFileType.getArgument();
|
|
+ }
|
|
+ // DivineMC end - Buffered Linear region format
|
|
+
|
|
private boolean doesRegionFilePossiblyExist(final long position) {
|
|
synchronized (this.nonExistingRegionFiles) {
|
|
if (this.nonExistingRegionFiles.contains(position)) {
|
|
@@ -94,15 +114,15 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
}
|
|
|
|
@Override
|
|
- public synchronized final RegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ) {
|
|
+ public synchronized final org.bxteam.divinemc.region.IRegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ) { // DivineMC - Buffered Linear region format
|
|
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkX >> REGION_SHIFT, chunkZ >> REGION_SHIFT));
|
|
}
|
|
|
|
@Override
|
|
- public synchronized final RegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException {
|
|
+ public synchronized final org.bxteam.divinemc.region.IRegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException { // DivineMC - Buffered Linear region format
|
|
final long key = ChunkPos.asLong(chunkX >> REGION_SHIFT, chunkZ >> REGION_SHIFT);
|
|
|
|
- RegionFile ret = this.regionCache.getAndMoveToFirst(key);
|
|
+ org.bxteam.divinemc.region.IRegionFile ret = this.regionCache.getAndMoveToFirst(key); // DivineMC - Buffered Linear region format
|
|
if (ret != null) {
|
|
return ret;
|
|
}
|
|
@@ -126,7 +146,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
|
|
FileUtil.createDirectoriesSafe(this.folder);
|
|
|
|
- ret = new RegionFile(this.info, regionPath, this.folder, this.sync);
|
|
+ ret = this.createNew(this.info, regionPath, this.folder, this.sync); // DivineMC - Buffered Linear region format
|
|
|
|
this.regionCache.putAndMoveToFirst(key, ret);
|
|
|
|
@@ -145,7 +165,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
}
|
|
|
|
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
|
|
- final RegionFile regionFile = this.getRegionFile(pos);
|
|
+ final org.bxteam.divinemc.region.IRegionFile regionFile = this.getRegionFile(pos); // DivineMC - Buffered Linear region format
|
|
|
|
// note: not required to keep regionfile loaded after this call, as the write param takes a regionfile as input
|
|
// (and, the regionfile parameter is unused for writing until the write call)
|
|
@@ -179,7 +199,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
) throws IOException {
|
|
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
|
|
if (writeData.result() == ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.WriteData.WriteResult.DELETE) {
|
|
- final RegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ);
|
|
+ final org.bxteam.divinemc.region.IRegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ); // DivineMC - Buffered Linear region format
|
|
if (regionFile != null) {
|
|
regionFile.clear(pos);
|
|
} // else: didn't exist
|
|
@@ -194,7 +214,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
public final ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.ReadData moonrise$readData(
|
|
final int chunkX, final int chunkZ
|
|
) throws IOException {
|
|
- final RegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ);
|
|
+ final org.bxteam.divinemc.region.IRegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ); // DivineMC - Buffered Linear region format
|
|
|
|
final DataInputStream input = regionFile == null ? null : regionFile.getChunkDataInputStream(new ChunkPos(chunkX, chunkZ));
|
|
|
|
@@ -239,7 +259,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
|
|
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
|
|
final ChunkPos headerChunkPos = SerializableChunkData.getChunkCoordinate(ret);
|
|
- final RegionFile regionFile = this.getRegionFile(pos);
|
|
+ final org.bxteam.divinemc.region.IRegionFile regionFile = this.getRegionFile(pos); // DivineMC - Buffered Linear region format
|
|
|
|
if (regionFile.getRecalculateCount() != readData.recalculateCount()) {
|
|
return null;
|
|
@@ -263,7 +283,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
}
|
|
// Paper end - rewrite chunk system
|
|
// Paper start - rewrite chunk system
|
|
- public RegionFile getRegionFile(ChunkPos chunkcoordintpair) throws IOException {
|
|
+ public org.bxteam.divinemc.region.IRegionFile getRegionFile(ChunkPos chunkcoordintpair) throws IOException { // DivineMC - Buffered Linear region format
|
|
return this.getRegionFile(chunkcoordintpair, false);
|
|
}
|
|
// Paper end - rewrite chunk system
|
|
@@ -275,7 +295,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
this.isChunkData = isChunkDataFolder(this.folder); // Paper - recalculate region file headers
|
|
}
|
|
|
|
- @org.jetbrains.annotations.Contract("_, false -> !null") @Nullable private RegionFile getRegionFile(ChunkPos chunkPos, boolean existingOnly) throws IOException { // CraftBukkit
|
|
+ @org.jetbrains.annotations.Contract("_, false -> !null") @Nullable private org.bxteam.divinemc.region.IRegionFile getRegionFile(ChunkPos chunkPos, boolean existingOnly) throws IOException { // CraftBukkit // DivineMC - Buffered Linear region format
|
|
// Paper start - rewrite chunk system
|
|
if (existingOnly) {
|
|
return this.moonrise$getRegionFileIfExists(chunkPos.x, chunkPos.z);
|
|
@@ -283,7 +303,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
synchronized (this) {
|
|
final long key = ChunkPos.asLong(chunkPos.x >> REGION_SHIFT, chunkPos.z >> REGION_SHIFT);
|
|
|
|
- RegionFile ret = this.regionCache.getAndMoveToFirst(key);
|
|
+ org.bxteam.divinemc.region.IRegionFile ret = this.regionCache.getAndMoveToFirst(key); // DivineMC - Buffered Linear region format
|
|
if (ret != null) {
|
|
return ret;
|
|
}
|
|
@@ -298,7 +318,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
|
|
FileUtil.createDirectoriesSafe(this.folder);
|
|
|
|
- ret = new RegionFile(this.info, regionPath, this.folder, this.sync);
|
|
+ ret = this.createNew(this.info, regionPath, this.folder, this.sync); // DivineMC - Buffered Linear region format
|
|
|
|
this.regionCache.putAndMoveToFirst(key, ret);
|
|
|
|
@@ -312,7 +332,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO DIVINEMC - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // DivineMC - Rebrand
|
|
}
|
|
|
|
- private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
|
|
+ private static CompoundTag readOversizedChunk(org.bxteam.divinemc.region.IRegionFile regionfile, ChunkPos chunkCoordinate) throws IOException { // DivineMC - Buffered Linear region format
|
|
synchronized (regionfile) {
|
|
try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
|
|
CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
|
|
@@ -347,7 +367,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
@Nullable
|
|
public CompoundTag read(ChunkPos chunkPos) throws IOException {
|
|
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
|
- RegionFile regionFile = this.getRegionFile(chunkPos, true);
|
|
+ org.bxteam.divinemc.region.IRegionFile regionFile = this.getRegionFile(chunkPos, true); // DivineMC - Buffered Linear region format
|
|
if (regionFile == null) {
|
|
return null;
|
|
}
|
|
@@ -386,7 +406,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
|
|
public void scanChunk(ChunkPos chunkPos, StreamTagVisitor visitor) throws IOException {
|
|
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
|
- RegionFile regionFile = this.getRegionFile(chunkPos, true);
|
|
+ org.bxteam.divinemc.region.IRegionFile regionFile = this.getRegionFile(chunkPos, true); // DivineMC - Buffered Linear region format
|
|
if (regionFile == null) {
|
|
return;
|
|
}
|
|
@@ -401,7 +421,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
|
|
public void write(ChunkPos chunkPos, @Nullable CompoundTag chunkData) throws IOException { // Paper - rewrite chunk system - public
|
|
if (!SharedConstants.DEBUG_DONT_SAVE_WORLD) {
|
|
- RegionFile regionFile = this.getRegionFile(chunkPos, chunkData == null); // CraftBukkit // Paper - rewrite chunk system
|
|
+ org.bxteam.divinemc.region.IRegionFile = this.getRegionFile(chunkPos, chunkData == null); // CraftBukkit // Paper - rewrite chunk system // DivineMC - Buffered Linear region format
|
|
// Paper start - rewrite chunk system
|
|
if (regionFile == null) {
|
|
// if the RegionFile doesn't exist, no point in deleting from it
|
|
@@ -432,7 +452,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
// Paper start - rewrite chunk system
|
|
synchronized (this) {
|
|
final ExceptionCollector<IOException> exceptionCollector = new ExceptionCollector<>();
|
|
- for (final RegionFile regionFile : this.regionCache.values()) {
|
|
+ for (final org.bxteam.divinemc.region.IRegionFile regionFile : this.regionCache.values()) { // DivineMC - Buffered Linear region format
|
|
try {
|
|
regionFile.close();
|
|
} catch (final IOException ex) {
|
|
@@ -448,7 +468,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
// Paper start - rewrite chunk system
|
|
synchronized (this) {
|
|
final ExceptionCollector<IOException> exceptionCollector = new ExceptionCollector<>();
|
|
- for (final RegionFile regionFile : this.regionCache.values()) {
|
|
+ for (final org.bxteam.divinemc.region.IRegionFile regionFile : this.regionCache.values()) { // DivineMC - Buffered Linear region format
|
|
try {
|
|
regionFile.flush();
|
|
} catch (final IOException ex) {
|