mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
329 lines
23 KiB
Diff
329 lines
23 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Sun, 16 Mar 2025 21:16:55 +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..fdccc27c528b01b16a72e614ffd96523aa6f50d2 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 - Linear region file 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 - Linear region file 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 98fbc5c8044bd945d64569f13412a6e7e49a4e7f..34682217252cb98a70511a8cb25f077ec9f872b8 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
|
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
|
|
@@ -1260,7 +1260,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 - Linear region file format
|
|
if (regionFile != null) {
|
|
regionFile.flush();
|
|
} // else: evicted from cache, which should have called flush
|
|
@@ -1470,7 +1470,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 - Linear region file 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..8713d00d767c9225a0823d2fdbb0b479005738d7 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java
|
|
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java
|
|
@@ -8,5 +8,5 @@ public interface ChunkSystemChunkBuffer {
|
|
|
|
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 - Linear region file format
|
|
}
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
|
index 26a4a279122bb03a83dd4a34e780d6a4567ba3a8..51b79f614417f231951e9ba05b29ff0044e081e7 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -947,10 +947,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
// CraftBukkit end
|
|
if (flush) {
|
|
for (ServerLevel serverLevel2 : this.getAllLevels()) {
|
|
- LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", serverLevel2.getChunkSource().chunkMap.getStorageName());
|
|
+ LOGGER.info("ThreadedChunkStorage ({}): All chunks are saved", serverLevel2.getChunkSource().chunkMap.getStorageName()); // DivineMC - Linear region file format
|
|
}
|
|
|
|
- LOGGER.info("ThreadedAnvilChunkStorage: All dimensions are saved");
|
|
+ LOGGER.info("ThreadedChunkStorage: All dimensions are saved"); // DivineMC - Linear region file format
|
|
}
|
|
|
|
return flag;
|
|
diff --git a/net/minecraft/util/worldupdate/WorldUpgrader.java b/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c72522f922 100644
|
|
--- a/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
+++ b/net/minecraft/util/worldupdate/WorldUpgrader.java
|
|
@@ -72,7 +72,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]+)\\.(linear | mca)$"); // DivineMC - Linear region file format
|
|
final DimensionDataStorage overworldDataStorage;
|
|
|
|
public WorldUpgrader(
|
|
@@ -261,7 +261,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(".linear") || filename.endsWith(".mca")); // DivineMC - Linear region file format
|
|
if (files == null) {
|
|
return List.of();
|
|
} else {
|
|
@@ -274,7 +274,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 = org.bxteam.divinemc.region.RegionFileFactory.getAbstractRegionFile(regionStorageInfo, file.toPath(), path, true)) { // DivineMC - Linear region file format
|
|
for (int i2 = 0; i2 < 32; i2++) {
|
|
for (int i3 = 0; i3 < 32; i3++) {
|
|
ChunkPos chunkPos = new ChunkPos(i2 + i, i3 + i1);
|
|
@@ -322,7 +322,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 - Linear region file format
|
|
if (WorldUpgrader.this.recreateRegionFiles) {
|
|
if (this.previousWriteFuture != null) {
|
|
this.previousWriteFuture.join();
|
|
@@ -424,7 +424,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 - Linear region file 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 c72494e757a9dc50e053dbc873f7b30e83d5cb8c..2988084cf2d72557dd304dcb904d09441e79863d 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 - Linear region file 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;
|
|
@@ -904,7 +904,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 - Linear region file 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 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb1f14d256 100644
|
|
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
|
@@ -18,7 +18,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 - Linear region file format
|
|
private final RegionStorageInfo info;
|
|
private final Path folder;
|
|
private final boolean sync;
|
|
@@ -33,7 +33,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
@Nullable
|
|
public static ChunkPos getRegionFileCoordinates(Path file) {
|
|
String fileName = file.getFileName().toString();
|
|
- if (!fileName.startsWith("r.") || !fileName.endsWith(".mca")) {
|
|
+ if (!fileName.startsWith("r.") || !fileName.endsWith(".mca") || !fileName.endsWith(".linear")) { // DivineMC - Linear region file format
|
|
return null;
|
|
}
|
|
|
|
@@ -58,6 +58,12 @@ 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) {
|
|
+ // DivineMC start - Linear region file format
|
|
+ if (org.bxteam.divinemc.DivineConfig.regionFormatTypeName == org.bxteam.divinemc.region.RegionFileFormat.LINEAR) {
|
|
+ return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + ".linear";
|
|
+ }
|
|
+ // DivineMC end - Linear region file format
|
|
+
|
|
return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + ".mca";
|
|
}
|
|
|
|
@@ -93,15 +99,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 - Linear region file 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 - Linear region file 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 - Linear region file format
|
|
if (ret != null) {
|
|
return ret;
|
|
}
|
|
@@ -125,7 +131,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
|
|
FileUtil.createDirectoriesSafe(this.folder);
|
|
|
|
- ret = new RegionFile(this.info, regionPath, this.folder, this.sync);
|
|
+ ret = org.bxteam.divinemc.region.RegionFileFactory.getAbstractRegionFile(this.info, regionPath, this.folder, this.sync); // DivineMC - Linear region file format
|
|
|
|
this.regionCache.putAndMoveToFirst(key, ret);
|
|
|
|
@@ -144,11 +150,11 @@ 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 - Linear region file 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)
|
|
- final ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.WriteData writeData = ((ca.spottedleaf.moonrise.patches.chunk_system.storage.ChunkSystemRegionFile)regionFile).moonrise$startWrite(compound, pos);
|
|
+ final ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.WriteData writeData = regionFile.moonrise$startWrite(compound, pos); // DivineMC - Linear region file format
|
|
|
|
try { // Paper - implement RegionFileSizeException
|
|
try {
|
|
@@ -178,7 +184,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 - Linear region file format
|
|
if (regionFile != null) {
|
|
regionFile.clear(pos);
|
|
} // else: didn't exist
|
|
@@ -193,7 +199,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 - Linear region file format
|
|
|
|
final DataInputStream input = regionFile == null ? null : regionFile.getChunkDataInputStream(new ChunkPos(chunkX, chunkZ));
|
|
|
|
@@ -237,7 +243,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 - Linear region file format
|
|
return this.getRegionFile(chunkcoordintpair, false);
|
|
}
|
|
// Paper end - rewrite chunk system
|
|
@@ -249,7 +255,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 - Linear region file format
|
|
// Paper start - rewrite chunk system
|
|
if (existingOnly) {
|
|
return this.moonrise$getRegionFileIfExists(chunkPos.x, chunkPos.z);
|
|
@@ -257,7 +263,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 - Linear region file format
|
|
if (ret != null) {
|
|
return ret;
|
|
}
|
|
@@ -272,7 +278,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
|
|
FileUtil.createDirectoriesSafe(this.folder);
|
|
|
|
- ret = new RegionFile(this.info, regionPath, this.folder, this.sync);
|
|
+ ret = org.bxteam.divinemc.region.RegionFileFactory.getAbstractRegionFile(this.info, regionPath, this.folder, this.sync); // DivineMC - Linear region file format
|
|
|
|
this.regionCache.putAndMoveToFirst(key, ret);
|
|
|
|
@@ -286,7 +292,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 - Linear region file format
|
|
synchronized (regionfile) {
|
|
try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
|
|
CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
|
|
@@ -321,7 +327,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 - Linear region file format
|
|
if (regionFile == null) {
|
|
return null;
|
|
}
|
|
@@ -360,7 +366,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 - Linear region file format
|
|
if (regionFile == null) {
|
|
return;
|
|
}
|
|
@@ -374,7 +380,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
}
|
|
|
|
public void write(ChunkPos chunkPos, @Nullable CompoundTag chunkData) throws IOException { // Paper - rewrite chunk system - public
|
|
- 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 - Linear region file format
|
|
// Paper start - rewrite chunk system
|
|
if (regionFile == null) {
|
|
// if the RegionFile doesn't exist, no point in deleting from it
|
|
@@ -404,7 +410,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 - Linear region file format
|
|
try {
|
|
regionFile.close();
|
|
} catch (final IOException ex) {
|
|
@@ -420,7 +426,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 - Linear region file format
|
|
try {
|
|
regionFile.flush();
|
|
} catch (final IOException ex) {
|