From 60c15112addb159f21e86e2a2f351441b20e6a23 Mon Sep 17 00:00:00 2001 From: 404Setup <153366651+404Setup@users.noreply.github.com> Date: Wed, 28 Aug 2024 08:59:45 +0800 Subject: [PATCH] update config --- patches/api/0004-Vine-Config.patch | 22 ++++++--- patches/server/0003-Vine-Config.patch | 14 +++--- patches/server/0009-SectorFile.patch | 66 +++++++++++++-------------- 3 files changed, 56 insertions(+), 46 deletions(-) diff --git a/patches/api/0004-Vine-Config.patch b/patches/api/0004-Vine-Config.patch index 29f8a1f..c5c2082 100644 --- a/patches/api/0004-Vine-Config.patch +++ b/patches/api/0004-Vine-Config.patch @@ -107,10 +107,10 @@ index 0000000000000000000000000000000000000000..b743c171d46ec07cd5c2da71b272fe07 +} diff --git a/src/main/java/one/tranic/vine/region/Compression.java b/src/main/java/one/tranic/vine/region/Compression.java new file mode 100644 -index 0000000000000000000000000000000000000000..598d967fc91b3301015523a4698312200c17d45f +index 0000000000000000000000000000000000000000..2d8179733bbd2edcaa6acf77a2cb654d5d83a8d3 --- /dev/null +++ b/src/main/java/one/tranic/vine/region/Compression.java -@@ -0,0 +1,44 @@ +@@ -0,0 +1,49 @@ +package one.tranic.vine.region; + +public enum Compression { @@ -121,7 +121,11 @@ index 0000000000000000000000000000000000000000..598d967fc91b3301015523a469831220 + ZSTD, + BROTLI; + -+ public static Compression now; ++ private static Compression now; ++ ++ public static boolean equals(Compression input) { ++ return input.ordinal() == now.ordinal(); ++ } + + @Override + public String toString() { @@ -151,16 +155,17 @@ index 0000000000000000000000000000000000000000..598d967fc91b3301015523a469831220 + } + + public static void setNow(final Compression now) { ++ if (Compression.now != null) throw new RuntimeException("Disallow reassignment to \"now\"."); + one.tranic.vine.config.VineConfig.Feature.Region.compressionFormat = now; + Compression.now = now; + } +} diff --git a/src/main/java/one/tranic/vine/region/Format.java b/src/main/java/one/tranic/vine/region/Format.java new file mode 100644 -index 0000000000000000000000000000000000000000..0e302de56b2a294a975d5b257012c16d78fd57ea +index 0000000000000000000000000000000000000000..cd4967fd8341c33ef88f987a13c1ab3a665408bc --- /dev/null +++ b/src/main/java/one/tranic/vine/region/Format.java -@@ -0,0 +1,35 @@ +@@ -0,0 +1,40 @@ +package one.tranic.vine.region; + +public enum Format { @@ -168,7 +173,11 @@ index 0000000000000000000000000000000000000000..0e302de56b2a294a975d5b257012c16d + LINEAR, + SECTORFILE; + -+ public static Format now; ++ private static Format now; ++ ++ public static boolean equals(Format input) { ++ return input.ordinal() == now.ordinal(); ++ } + + @Override + public String toString() { @@ -192,6 +201,7 @@ index 0000000000000000000000000000000000000000..0e302de56b2a294a975d5b257012c16d + } + + public static void setNow(Format now) { ++ if (Format.now != null) throw new RuntimeException("Disallow reassignment to \"now\"."); + one.tranic.vine.config.VineConfig.Feature.Region.format = now; + Format.now = now; + } diff --git a/patches/server/0003-Vine-Config.patch b/patches/server/0003-Vine-Config.patch index e93aa8c..f7bbef0 100644 --- a/patches/server/0003-Vine-Config.patch +++ b/patches/server/0003-Vine-Config.patch @@ -127,7 +127,7 @@ index 0000000000000000000000000000000000000000..819da2962087ce70c6b9b4ec758937ef \ No newline at end of file diff --git a/src/main/kotlin/one/tranic/vine/config/ConfigUtil.kt b/src/main/kotlin/one/tranic/vine/config/ConfigUtil.kt new file mode 100644 -index 0000000000000000000000000000000000000000..38064202131f042d3d38757afdab76960b4fb232 +index 0000000000000000000000000000000000000000..655dcd125a58aec84ee93a90cf087b0b10052830 --- /dev/null +++ b/src/main/kotlin/one/tranic/vine/config/ConfigUtil.kt @@ -0,0 +1,148 @@ @@ -183,7 +183,7 @@ index 0000000000000000000000000000000000000000..38064202131f042d3d38757afdab7696 + reload() + // If SECTORFILE is enabled and BROTLI is selected as the compression format, + // initialize the dependent libraries. -+ if (Format.getNow().equals(Format.SECTORFILE) && Compression.getNow().equals(Compression.BROTLI)) { ++ if (Format.equals(Format.SECTORFILE) && Compression.equals(Compression.BROTLI)) { + Brotli4jLoader.ensureAvailability() + } + } @@ -471,7 +471,7 @@ index 0000000000000000000000000000000000000000..1912152e305c4aa92e23335990b847b6 \ No newline at end of file diff --git a/src/main/kotlin/one/tranic/vine/config/module/feature/Region.kt b/src/main/kotlin/one/tranic/vine/config/module/feature/Region.kt new file mode 100644 -index 0000000000000000000000000000000000000000..39cd03eb8475d673609c40fae6d9cb96a99dd92e +index 0000000000000000000000000000000000000000..904816530087bc3938228070eaf2fe05abfbffb6 --- /dev/null +++ b/src/main/kotlin/one/tranic/vine/config/module/feature/Region.kt @@ -0,0 +1,87 @@ @@ -528,20 +528,20 @@ index 0000000000000000000000000000000000000000..39cd03eb8475d673609c40fae6d9cb96 + + override fun load() { + getString("feature.region.format") { ++ val b = Format.getFormat(it) + if (Locker.regionFormat == null) { -+ val b = Format.getFormat(it) + Locker.regionFormat = b + Format.setNow(b) -+ } else if (Locker.regionFormat != Format.getFormat(it)) { ++ } else if (!b.equals(Locker.regionFormat)) { + VineLogger.error("Forbidden to modify the parameter \"feature.region.format\" during runtime!!!") + } + } + getString("feature.region.compression-format") { ++ val b = Compression.getCompression(it) + if (Locker.compressionFormat == null) { -+ val b = Compression.getCompression(it) + Locker.compressionFormat = b + Compression.setNow(b) -+ } else if (Locker.compressionFormat != Compression.getCompression(it)) { ++ } else if (!b.equals(Locker.compressionFormat)) { + VineLogger.error("Forbidden to modify the parameter \"feature.region.compression-format\" during runtime!!!") + } + } diff --git a/patches/server/0009-SectorFile.patch b/patches/server/0009-SectorFile.patch index 3d07b36..435bf28 100644 --- a/patches/server/0009-SectorFile.patch +++ b/patches/server/0009-SectorFile.patch @@ -4654,7 +4654,7 @@ index 0000000000000000000000000000000000000000..d9ff261d33da6aee7f89289c13fb7ac0 +} \ No newline at end of file diff --git a/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java b/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java -index 2096e57c025858519e7c46788993b9aac1ec60e8..dbcd38bbdca58e74d52ae6c032fc1a3ad3420186 100644 +index 2096e57c025858519e7c46788993b9aac1ec60e8..6e3fa8dd0a6384b246af562fcff8c13555e845ab 100644 --- a/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java +++ b/src/main/java/io/papermc/paper/chunk/system/io/RegionFileIOThread.java @@ -6,6 +6,9 @@ import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor; @@ -4715,14 +4715,14 @@ index 2096e57c025858519e7c46788993b9aac1ec60e8..dbcd38bbdca58e74d52ae6c032fc1a3a } public boolean doesRegionFileNotExist(final int chunkX, final int chunkZ) { -+ if (Format.getNow().equals(Format.SECTORFILE)) { ++ if (Format.equals(Format.SECTORFILE)) { + return this.getSectorCache().doesSectorFileNotExistNoIO(chunkX, chunkZ); + } return this.getCache().doesRegionFileNotExistNoIO(new ChunkPos(chunkX, chunkZ)); } public T computeForRegionFile(final int chunkX, final int chunkZ, final boolean existingOnly, final Function function) { -+ if (Format.getNow().equals(Format.SECTORFILE)) return null; ++ if (Format.equals(Format.SECTORFILE)) return null; final RegionFileStorage cache = this.getCache(); final RegionFile regionFile; synchronized (cache) { @@ -4731,7 +4731,7 @@ index 2096e57c025858519e7c46788993b9aac1ec60e8..dbcd38bbdca58e74d52ae6c032fc1a3a } + public T computeForSectorFile(final int chunkX, final int chunkZ, final boolean existingOnly, final BiFunction function) { -+ if (!Format.getNow().equals(Format.SECTORFILE)) return null; ++ if (!Format.equals(Format.SECTORFILE)) return null; + final SectorFileCache cache = this.getSectorCache(); + final SectorFile regionFile; + synchronized (cache) { @@ -4746,7 +4746,7 @@ index 2096e57c025858519e7c46788993b9aac1ec60e8..dbcd38bbdca58e74d52ae6c032fc1a3a + } + public T computeForRegionFileIfLoaded(final int chunkX, final int chunkZ, final Function function) { -+ if (Format.getNow().equals(Format.SECTORFILE)) return null; ++ if (Format.equals(Format.SECTORFILE)) return null; final RegionFileStorage cache = this.getCache(); final RegionFile regionFile; @@ -4769,7 +4769,7 @@ index 2096e57c025858519e7c46788993b9aac1ec60e8..dbcd38bbdca58e74d52ae6c032fc1a3a static final class ChunkDataTask implements Runnable { diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java -index 6b83f09f9862e298cad009b3e3a384478f616030..2b16e19153cebebd9f3883f09e071fe5ddb89a5e 100644 +index 6b83f09f9862e298cad009b3e3a384478f616030..e7e94764b77c8c2327b08e4e156e0502df9fcc8f 100644 --- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java +++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java @@ -36,6 +36,7 @@ import net.minecraft.server.level.TicketType; @@ -4788,11 +4788,11 @@ index 6b83f09f9862e298cad009b3e3a384478f616030..2b16e19153cebebd9f3883f09e071fe5 + // kill regionfile/sectorfile cache try { - this.world.chunkDataControllerNew.getCache().close(); -+ if (Format.getNow().equals(Format.SECTORFILE)) this.world.sectorFileCache.close(); else this.world.chunkDataControllerNew.getCache().close(); ++ if (Format.equals(Format.SECTORFILE)) this.world.sectorFileCache.close(); else this.world.chunkDataControllerNew.getCache().close(); } catch (final IOException ex) { LOGGER.error("Failed to close chunk regionfile cache for world '" + this.world.getWorld().getName() + "'", ex); } -+ if (Format.getNow().equals(Format.SECTORFILE)) return; ++ if (Format.equals(Format.SECTORFILE)) return; try { this.world.entityDataControllerNew.getCache().close(); } catch (final IOException ex) { @@ -4801,12 +4801,12 @@ index 6b83f09f9862e298cad009b3e3a384478f616030..2b16e19153cebebd9f3883f09e071fe5 if (this.world.paperConfig().chunks.flushRegionsOnSave) { try { - this.world.chunkSource.chunkMap.regionFileCache.flush(); -+ if (Format.getNow().equals(Format.SECTORFILE)) this.world.sectorFileCache.flush(); else this.world.chunkSource.chunkMap.regionFileCache.flush(); ++ if (Format.equals(Format.SECTORFILE)) this.world.sectorFileCache.flush(); else this.world.chunkSource.chunkMap.regionFileCache.flush(); } catch (IOException ex) { LOGGER.error("Exception when flushing regions in world {}", this.world.getWorld().getName(), ex); } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 9fe91892ce469bc207ad9ca4f3ca3f9f1ebef794..f93c2004726eac37f45112c2afde3d50c987cdb2 100644 +index 9fe91892ce469bc207ad9ca4f3ca3f9f1ebef794..67be68e0ab1e2f206b6be6db820a6067b5c03b86 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -105,6 +105,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp @@ -4822,7 +4822,7 @@ index 9fe91892ce469bc207ad9ca4f3ca3f9f1ebef794..f93c2004726eac37f45112c2afde3d50 public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { - super(new RegionStorageInfo(session.getLevelId(), world.dimension(), "chunk"), session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); -+ super(Format.getNow().equals(Format.SECTORFILE) ? null : new RegionStorageInfo(session.getLevelId(), world.dimension(), "chunk"), Format.getNow().equals(Format.SECTORFILE) ? world.sectorFileCache : null, session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); ++ super(Format.equals(Format.SECTORFILE) ? null : new RegionStorageInfo(session.getLevelId(), world.dimension(), "chunk"), Format.getNow().equals(Format.SECTORFILE) ? world.sectorFileCache : null, session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); // Paper - rewrite chunk system this.tickingGenerated = new AtomicInteger(); this.playerMap = new PlayerMap(); @@ -4830,14 +4830,14 @@ index 9fe91892ce469bc207ad9ca4f3ca3f9f1ebef794..f93c2004726eac37f45112c2afde3d50 } public ChunkStatus getChunkStatusOnDiskIfCached(ChunkPos chunkPos) { -+ if (Format.getNow().equals(Format.SECTORFILE)) return null; ++ if (Format.equals(Format.SECTORFILE)) return null; net.minecraft.world.level.chunk.storage.RegionFile regionFile = regionFileCache.getRegionFileIfLoaded(chunkPos); return regionFile == null ? null : regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); } public ChunkStatus getChunkStatusOnDisk(ChunkPos chunkPos) throws IOException { -+ if (Format.getNow().equals(Format.SECTORFILE)) { ++ if (Format.equals(Format.SECTORFILE)) { + CompoundTag nbt = this.readConvertChunkSync(chunkPos); + return nbt == null ? null : ChunkSerializer.getStatus(nbt); + } @@ -4848,12 +4848,12 @@ index 9fe91892ce469bc207ad9ca4f3ca3f9f1ebef794..f93c2004726eac37f45112c2afde3d50 } public void updateChunkStatusOnDisk(ChunkPos chunkPos, @Nullable CompoundTag compound) throws IOException { -+ if (Format.getNow().equals(Format.SECTORFILE)) return; ++ if (Format.equals(Format.SECTORFILE)) return; net.minecraft.world.level.chunk.storage.RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, false); regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkSerializer.getStatus(compound)); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 6b2f07689a91daedd6f9bfa809227b52ce91ff20..71cdb8322a28b51f031efe74e59d3d2ac1bbf013 100644 +index 6b2f07689a91daedd6f9bfa809227b52ce91ff20..7c0dd49485ed4993fcb22c306122aa4ec539cf9a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -164,6 +164,7 @@ import net.minecraft.world.phys.shapes.BooleanOp; @@ -4907,7 +4907,7 @@ index 6b2f07689a91daedd6f9bfa809227b52ce91ff20..71cdb8322a28b51f031efe74e59d3d2a return; } - this.entityStorage.write(new ChunkPos(chunkX, chunkZ), compound); -+ if (!Format.getNow().equals(Format.SECTORFILE)) this.entityStorage.write(new ChunkPos(chunkX, chunkZ), compound); ++ if (!Format.equals(Format.SECTORFILE)) this.entityStorage.write(new ChunkPos(chunkX, chunkZ), compound); } private net.minecraft.nbt.CompoundTag readEntityChunk(int chunkX, int chunkZ) throws IOException { @@ -4915,7 +4915,7 @@ index 6b2f07689a91daedd6f9bfa809227b52ce91ff20..71cdb8322a28b51f031efe74e59d3d2a io.papermc.paper.chunk.system.io.RegionFileIOThread.getIOBlockingPriorityForCurrentThread() ); } -+ if (Format.getNow().equals(Format.SECTORFILE)) { ++ if (Format.equals(Format.SECTORFILE)) { + return this.sectorFileCache.read( + ca.spottedleaf.io.region.SectorFileCache.getUnscopedBufferChoices(), chunkX, chunkZ, + ca.spottedleaf.io.region.MinecraftRegionFileType.ENTITY.getNewId() @@ -4929,7 +4929,7 @@ index 6b2f07689a91daedd6f9bfa809227b52ce91ff20..71cdb8322a28b51f031efe74e59d3d2a boolean flag2 = minecraftserver.forceSynchronousWrites(); DataFixer datafixer = minecraftserver.getFixerUpper(); - this.entityStorage = new EntityRegionFileStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), flag2); // Paper - rewrite chunk system -+ if (Format.getNow().equals(Format.SECTORFILE)) { ++ if (Format.equals(Format.SECTORFILE)) { + this.sectorFileCache = new ca.spottedleaf.io.region.SectorFileCache(convertable_conversionsession.getDimensionPath(resourcekey).resolve("sectors").toFile(), flag2); + this.entityStorage = null; + } else { @@ -4940,7 +4940,7 @@ index 6b2f07689a91daedd6f9bfa809227b52ce91ff20..71cdb8322a28b51f031efe74e59d3d2a // this.entityManager = new PersistentEntitySectionManager<>(Entity.class, new ServerLevel.EntityCallbacks(), entitypersistentstorage, this.entitySliceManager); // Paper // Paper - rewrite chunk system StructureTemplateManager structuretemplatemanager = minecraftserver.getStructureManager(); diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java -index 5b60a7fc75d0e2beafb8787fbe0708e07c7203f8..d0e7edde62c1e0bfe3d046ca438bd9f97d1c1c83 100644 +index 5b60a7fc75d0e2beafb8787fbe0708e07c7203f8..7eb9ceeea08e3c2b0b23b64b4df22868b157fcc9 100644 --- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java +++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java @@ -47,6 +47,7 @@ import net.minecraft.world.level.chunk.storage.SimpleRegionStorage; @@ -4955,7 +4955,7 @@ index 5b60a7fc75d0e2beafb8787fbe0708e07c7203f8..d0e7edde62c1e0bfe3d046ca438bd9f9 final DimensionDataStorage overworldDataStorage; public WorldUpgrader(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, RegistryAccess dynamicRegistryManager, boolean eraseCache, boolean recreateRegionFiles) { -+ if (Format.getNow().equals(Format.SECTORFILE)) throw new UnsupportedOperationException(); ++ if (Format.equals(Format.SECTORFILE)) throw new UnsupportedOperationException(); this.dimensions = dynamicRegistryManager.registryOrThrow(Registries.LEVEL_STEM); this.levels = (Set) java.util.stream.Stream.of(session.dimensionType).map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet()); // CraftBukkit this.eraseCache = eraseCache; @@ -4964,13 +4964,13 @@ index 5b60a7fc75d0e2beafb8787fbe0708e07c7203f8..d0e7edde62c1e0bfe3d046ca438bd9f9 @Override protected ChunkStorage createStorage(RegionStorageInfo key, Path worldDirectory) { - return (ChunkStorage) (WorldUpgrader.this.recreateRegionFiles ? new RecreatingChunkStorage(key.withTypeSuffix("source"), worldDirectory, key.withTypeSuffix("target"), WorldUpgrader.resolveRecreateDirectory(worldDirectory), WorldUpgrader.this.dataFixer, true) : new ChunkStorage(key, worldDirectory, WorldUpgrader.this.dataFixer, true)); -+ if (Format.getNow().equals(Format.SECTORFILE)) return WorldUpgrader.this.recreateRegionFiles ? new RecreatingChunkStorage(key.withTypeSuffix("source"), worldDirectory, key.withTypeSuffix("target"), WorldUpgrader.resolveRecreateDirectory(worldDirectory), WorldUpgrader.this.dataFixer, true) : new ChunkStorage(null, worldDirectory, WorldUpgrader.this.dataFixer, true); ++ if (Format.equals(Format.SECTORFILE)) return WorldUpgrader.this.recreateRegionFiles ? new RecreatingChunkStorage(key.withTypeSuffix("source"), worldDirectory, key.withTypeSuffix("target"), WorldUpgrader.resolveRecreateDirectory(worldDirectory), WorldUpgrader.this.dataFixer, true) : new ChunkStorage(null, worldDirectory, WorldUpgrader.this.dataFixer, true); + return WorldUpgrader.this.recreateRegionFiles ? new RecreatingChunkStorage(key.withTypeSuffix("source"), worldDirectory, key.withTypeSuffix("target"), WorldUpgrader.resolveRecreateDirectory(worldDirectory), WorldUpgrader.this.dataFixer, true) : new ChunkStorage(key, worldDirectory, WorldUpgrader.this.dataFixer, true); } } diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index 256fbdc2a287a8232c8ecb9d0e06290a141a49ee..189236175eb31232b3597077f36e0b982580e41d 100644 +index 256fbdc2a287a8232c8ecb9d0e06290a141a49ee..39698b8f6f5007f6fb093f303fdf2390451e3125 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java @@ -36,6 +36,7 @@ import net.minecraft.world.level.chunk.status.ChunkStatus; @@ -4985,7 +4985,7 @@ index 256fbdc2a287a8232c8ecb9d0e06290a141a49ee..189236175eb31232b3597077f36e0b98 ); } // Paper end - rewrite chunk system -+ if (Format.getNow().equals(Format.SECTORFILE)) { ++ if (Format.equals(Format.SECTORFILE)) { + return this.world.sectorFileCache.read( + ca.spottedleaf.io.region.SectorFileCache.getUnscopedBufferChoices(), chunkcoordintpair.x, chunkcoordintpair.z, + ca.spottedleaf.io.region.MinecraftRegionFileType.POI.getNewId() @@ -5009,7 +5009,7 @@ index 256fbdc2a287a8232c8ecb9d0e06290a141a49ee..189236175eb31232b3597077f36e0b98 } // Paper end diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -index 7801fac96d728f951989fca36f6a4890a0638c36..49221b2f2b0459e4522db28407dac3a35cc937d0 100644 +index 7801fac96d728f951989fca36f6a4890a0638c36..3cc83a228a0246a997b4cc2f8ab5cc227df1657c 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java @@ -27,21 +27,36 @@ import net.minecraft.world.level.chunk.status.ChunkStatus; @@ -5054,7 +5054,7 @@ index 7801fac96d728f951989fca36f6a4890a0638c36..49221b2f2b0459e4522db28407dac3a3 } @Nullable public CompoundTag readSync(ChunkPos chunkPos) throws IOException { -+ if (Format.getNow().equals(Format.SECTORFILE)) ++ if (Format.equals(Format.SECTORFILE)) + return this.sectorCache.read( + ca.spottedleaf.io.region.SectorFileCache.getUnscopedBufferChoices(), + chunkPos.x, chunkPos.z, ca.spottedleaf.io.region.MinecraftRegionFileType.CHUNK.getNewId() @@ -5067,7 +5067,7 @@ index 7801fac96d728f951989fca36f6a4890a0638c36..49221b2f2b0459e4522db28407dac3a3 } // Paper end - guard against serializing mismatching coordinates - this.regionFileCache.write(chunkPos, nbt); // Paper - rewrite chunk system; async chunk io, move above legacy structure index -+ if (Format.getNow().equals(Format.SECTORFILE)) ++ if (Format.equals(Format.SECTORFILE)) + this.sectorCache.write( + ca.spottedleaf.io.region.SectorFileCache.getUnscopedBufferChoices(), + chunkPos.x, chunkPos.z, ca.spottedleaf.io.region.MinecraftRegionFileType.CHUNK.getNewId(), nbt @@ -5081,7 +5081,7 @@ index 7801fac96d728f951989fca36f6a4890a0638c36..49221b2f2b0459e4522db28407dac3a3 public void close() throws IOException { - this.regionFileCache.close(); // Paper - nuke IO worker -+ if (!Format.getNow().equals(Format.SECTORFILE)) this.regionFileCache.close(); // Paper - nuke IO worker ++ if (!Format.equals(Format.SECTORFILE)) this.regionFileCache.close(); // Paper - nuke IO worker } public ChunkScanAccess chunkScanner() { @@ -5089,7 +5089,7 @@ index 7801fac96d728f951989fca36f6a4890a0638c36..49221b2f2b0459e4522db28407dac3a3 return ((chunkPos, streamTagVisitor) -> { try { - this.regionFileCache.scanChunk(chunkPos, streamTagVisitor); -+ if (Format.getNow().equals(Format.SECTORFILE)) ++ if (Format.equals(Format.SECTORFILE)) + this.sectorCache.scanChunk( + ca.spottedleaf.io.region.SectorFileCache.getUnscopedBufferChoices(), + chunkPos.x, chunkPos.z, ca.spottedleaf.io.region.MinecraftRegionFileType.CHUNK.getNewId(), @@ -5132,7 +5132,7 @@ index f4a39f49b354c560d614483db1cd3dfc154e94b4..93ad07729d5d184a435169eebd5264a8 case GZIP -> VERSION_GZIP; case ZLIB -> VERSION_DEFLATE; diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index a4a919d8373f1535e336de7e648d41a07efb1cba..887073b2967bd832321130b2aca26e1983b389c8 100644 +index a4a919d8373f1535e336de7e648d41a07efb1cba..606fb664fb5fd87d729ad54ff6c8a0a6daaa935c 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java @@ -30,6 +30,7 @@ import net.minecraft.nbt.Tag; @@ -5149,13 +5149,13 @@ index a4a919d8373f1535e336de7e648d41a07efb1cba..887073b2967bd832321130b2aca26e19 + @Override + public CompoundTag read(ChunkPos pos) throws IOException { -+ if (Format.getNow().equals(Format.SECTORFILE)) throw new AbstractMethodError(); ++ if (Format.equals(Format.SECTORFILE)) throw new AbstractMethodError(); + else return super.read(pos); + } + + @Override + public void write(ChunkPos pos, CompoundTag tag) throws IOException { -+ if (Format.getNow().equals(Format.SECTORFILE)) throw new AbstractMethodError(); ++ if (Format.equals(Format.SECTORFILE)) throw new AbstractMethodError(); + else super.write(pos, tag); + } + @@ -5171,7 +5171,7 @@ index a4a919d8373f1535e336de7e648d41a07efb1cba..887073b2967bd832321130b2aca26e19 } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 12091e6b2696f7adf5275988ecc4cdc51e6760be..00b226e6f24568eebf6b7e209c533a3e9acd65c3 100644 +index 12091e6b2696f7adf5275988ecc4cdc51e6760be..fda86def740ef681808de0014bc906f5060c5a9e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -71,6 +71,7 @@ import net.minecraft.world.phys.AABB; @@ -5192,7 +5192,7 @@ index 12091e6b2696f7adf5275988ecc4cdc51e6760be..00b226e6f24568eebf6b7e209c533a3e - } catch (java.io.IOException ex) { - throw new RuntimeException(ex); - } -+ if (!Format.getNow().equals(Format.SECTORFILE)) { ++ if (!Format.equals(Format.SECTORFILE)) { + net.minecraft.world.level.chunk.storage.RegionFile file; + try { + file = world.getChunkSource().chunkMap.regionFileCache.getRegionFile(chunkPos, false);