mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
353 lines
24 KiB
Diff
353 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 aa3d5a6ea59ac77665f2cfaa56a7d383016d08d0..e3c99b70f026261cff01629d0f9250929d215a70 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
|
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
|
@@ -1274,7 +1274,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
|
|
@@ -1490,7 +1490,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 580746b5c66a60949281f4a0f814b2e8df161fb9..27021e41d5f9f5fb5763eba929ba8f6eb46fb9fa 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -963,10 +963,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 2fa99d5e092c14733da1acf00d9f0cc126f6f04d..37703b66696df61f316c087328641a73cf5eefbc 100644
|
|
--- a/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
+++ b/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
@@ -77,7 +77,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(
|
|
@@ -270,7 +270,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 {
|
|
@@ -283,7 +283,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);
|
|
@@ -331,7 +331,7 @@ public class WorldUpgrader implements AutoCloseable {
|
|
|
|
protected abstract boolean tryProcessOnePosition(SimpleRegionStorage regionStorage, 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();
|
|
@@ -441,7 +441,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 e4cbe8d6176c2174ed5fffb9ea28f69c12dc9f1e..70e9c7a649a7c5145ecdb679f5fe54f3d060b6bd 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.world.level.ChunkPos;
|
|
import org.jspecify.annotations.Nullable;
|
|
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;
|
|
@@ -909,7 +909,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 dbea0449cebd448f5b165097aee8633e4d8bac67..9d73b706167d5d997b1af018c7ceaf0d200c7ff1 100644
|
|
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
@@ -15,11 +15,13 @@ import net.minecraft.util.FileUtil;
|
|
import net.minecraft.world.level.ChunkPos;
|
|
import org.jspecify.annotations.Nullable;
|
|
|
|
+import org.bxteam.divinemc.region.IRegionFile; // DivineMC - Linear region file format
|
|
+
|
|
public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.io.ChunkSystemRegionFileStorage { // Paper - rewrite chunk system
|
|
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,8 +61,28 @@ 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) {
|
|
@@ -94,15 +116,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 +148,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 +167,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 +201,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 +216,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 +261,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 +285,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 +297,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 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 +305,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 +320,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 +334,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);
|
|
@@ -346,7 +368,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
|
|
public @Nullable 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;
|
|
}
|
|
@@ -385,7 +407,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;
|
|
}
|
|
@@ -400,7 +422,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 regionFile = 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
|
|
@@ -431,7 +453,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) {
|
|
@@ -447,7 +469,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) {
|