diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/util/worldupdate/WorldUpgrader.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/util/worldupdate/WorldUpgrader.java.patch | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/util/worldupdate/WorldUpgrader.java.patch b/patch-remap/mache-spigotflower/net/minecraft/util/worldupdate/WorldUpgrader.java.patch new file mode 100644 index 0000000000..37805ff336 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/util/worldupdate/WorldUpgrader.java.patch @@ -0,0 +1,152 @@ +--- a/net/minecraft/util/worldupdate/WorldUpgrader.java ++++ b/net/minecraft/util/worldupdate/WorldUpgrader.java +@@ -64,13 +64,13 @@ + private static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$"); + private final DimensionDataStorage overworldDataStorage; + +- public WorldUpgrader(LevelStorageSource.LevelStorageAccess levelstoragesource_levelstorageaccess, DataFixer datafixer, Registry<LevelStem> registry, boolean flag) { +- this.dimensions = registry; +- this.levels = (Set) registry.registryKeySet().stream().map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet()); +- this.eraseCache = flag; +- this.dataFixer = datafixer; +- this.levelStorage = levelstoragesource_levelstorageaccess; +- this.overworldDataStorage = new DimensionDataStorage(this.levelStorage.getDimensionPath(Level.OVERWORLD).resolve("data").toFile(), datafixer); ++ public WorldUpgrader(LevelStorageSource.LevelStorageAccess levelStoarge, DataFixer dataFixer, Registry<LevelStem> dimensions, boolean eraseCache) { ++ this.dimensions = dimensions; ++ this.levels = (Set) java.util.stream.Stream.of(levelStoarge.dimensionType).map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet()); // CraftBukkit ++ this.eraseCache = eraseCache; ++ this.dataFixer = dataFixer; ++ this.levelStorage = levelStoarge; ++ this.overworldDataStorage = new DimensionDataStorage(this.levelStorage.getDimensionPath(Level.OVERWORLD).resolve("data").toFile(), dataFixer); + this.thread = WorldUpgrader.THREAD_FACTORY.newThread(this::work); + this.thread.setUncaughtExceptionHandler((thread, throwable) -> { + WorldUpgrader.LOGGER.error("Error upgrading world", throwable); +@@ -133,48 +133,48 @@ + for (Iterator iterator2 = this.levels.iterator(); iterator2.hasNext(); f1 += f2) { + ResourceKey<Level> resourcekey2 = (ResourceKey) iterator2.next(); + ListIterator<ChunkPos> listiterator = (ListIterator) immutablemap.get(resourcekey2); +- ChunkStorage chunkstorage = (ChunkStorage) immutablemap1.get(resourcekey2); ++ ChunkStorage ichunkloader = (ChunkStorage) immutablemap1.get(resourcekey2); + + if (listiterator.hasNext()) { +- ChunkPos chunkpos = (ChunkPos) listiterator.next(); ++ ChunkPos chunkcoordintpair = (ChunkPos) listiterator.next(); + boolean flag1 = false; + + try { +- CompoundTag compoundtag = (CompoundTag) ((Optional) chunkstorage.read(chunkpos).join()).orElse((Object) null); ++ CompoundTag nbttagcompound = (CompoundTag) ((Optional) ichunkloader.read(chunkcoordintpair).join()).orElse((Object) null); + +- if (compoundtag != null) { +- int j = ChunkStorage.getVersion(compoundtag); ++ if (nbttagcompound != null) { ++ int j = ChunkStorage.getVersion(nbttagcompound); + ChunkGenerator chunkgenerator = ((LevelStem) this.dimensions.getOrThrow(Registries.levelToLevelStem(resourcekey2))).generator(); +- CompoundTag compoundtag1 = chunkstorage.upgradeChunkTag(resourcekey2, () -> { ++ CompoundTag nbttagcompound1 = ichunkloader.upgradeChunkTag(Registries.levelToLevelStem(resourcekey2), () -> { // CraftBukkit + return this.overworldDataStorage; +- }, compoundtag, chunkgenerator.getTypeNameForDataFixer()); +- ChunkPos chunkpos1 = new ChunkPos(compoundtag1.getInt("xPos"), compoundtag1.getInt("zPos")); ++ }, nbttagcompound, chunkgenerator.getTypeNameForDataFixer(), chunkcoordintpair, null); // CraftBukkit ++ ChunkPos chunkcoordintpair1 = new ChunkPos(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos")); + +- if (!chunkpos1.equals(chunkpos)) { +- WorldUpgrader.LOGGER.warn("Chunk {} has invalid position {}", chunkpos, chunkpos1); ++ if (!chunkcoordintpair1.equals(chunkcoordintpair)) { ++ WorldUpgrader.LOGGER.warn("Chunk {} has invalid position {}", chunkcoordintpair, chunkcoordintpair1); + } + + boolean flag2 = j < SharedConstants.getCurrentVersion().getDataVersion().getVersion(); + + if (this.eraseCache) { +- flag2 = flag2 || compoundtag1.contains("Heightmaps"); +- compoundtag1.remove("Heightmaps"); +- flag2 = flag2 || compoundtag1.contains("isLightOn"); +- compoundtag1.remove("isLightOn"); +- ListTag listtag = compoundtag1.getList("sections", 10); ++ flag2 = flag2 || nbttagcompound1.contains("Heightmaps"); ++ nbttagcompound1.remove("Heightmaps"); ++ flag2 = flag2 || nbttagcompound1.contains("isLightOn"); ++ nbttagcompound1.remove("isLightOn"); ++ ListTag nbttaglist = nbttagcompound1.getList("sections", 10); + +- for (int k = 0; k < listtag.size(); ++k) { +- CompoundTag compoundtag2 = listtag.getCompound(k); ++ for (int k = 0; k < nbttaglist.size(); ++k) { ++ CompoundTag nbttagcompound2 = nbttaglist.getCompound(k); + +- flag2 = flag2 || compoundtag2.contains("BlockLight"); +- compoundtag2.remove("BlockLight"); +- flag2 = flag2 || compoundtag2.contains("SkyLight"); +- compoundtag2.remove("SkyLight"); ++ flag2 = flag2 || nbttagcompound2.contains("BlockLight"); ++ nbttagcompound2.remove("BlockLight"); ++ flag2 = flag2 || nbttagcompound2.contains("SkyLight"); ++ nbttagcompound2.remove("SkyLight"); + } + } + + if (flag2) { +- chunkstorage.write(chunkpos, compoundtag1); ++ ichunkloader.write(chunkcoordintpair, nbttagcompound1); + flag1 = true; + } + } +@@ -185,7 +185,7 @@ + throw reportedexception; + } + +- WorldUpgrader.LOGGER.error("Error upgrading chunk {}", chunkpos, throwable); ++ WorldUpgrader.LOGGER.error("Error upgrading chunk {}", chunkcoordintpair, throwable); + } + + if (flag1) { +@@ -211,10 +211,10 @@ + UnmodifiableIterator unmodifiableiterator = immutablemap1.values().iterator(); + + while (unmodifiableiterator.hasNext()) { +- ChunkStorage chunkstorage1 = (ChunkStorage) unmodifiableiterator.next(); ++ ChunkStorage ichunkloader1 = (ChunkStorage) unmodifiableiterator.next(); + + try { +- chunkstorage1.close(); ++ ichunkloader1.close(); + } catch (IOException ioexception) { + WorldUpgrader.LOGGER.error("Error upgrading chunk", ioexception); + } +@@ -227,8 +227,8 @@ + } + } + +- private List<ChunkPos> getAllChunkPos(ResourceKey<Level> resourcekey) { +- File file = this.levelStorage.getDimensionPath(resourcekey).toFile(); ++ private List<ChunkPos> getAllChunkPos(ResourceKey<Level> level) { ++ File file = this.levelStorage.getDimensionPath(level).toFile(); + File file1 = new File(file, "region"); + File[] afile = file1.listFiles((file2, s) -> { + return s.endsWith(".mca"); +@@ -255,10 +255,10 @@ + try { + for (int i1 = 0; i1 < 32; ++i1) { + for (int j1 = 0; j1 < 32; ++j1) { +- ChunkPos chunkpos = new ChunkPos(i1 + k, j1 + l); ++ ChunkPos chunkcoordintpair = new ChunkPos(i1 + k, j1 + l); + +- if (regionfile.doesChunkExist(chunkpos)) { +- list.add(chunkpos); ++ if (regionfile.doesChunkExist(chunkcoordintpair)) { ++ list.add(chunkcoordintpair); + } + } + } +@@ -291,8 +291,8 @@ + return this.levels; + } + +- public float dimensionProgress(ResourceKey<Level> resourcekey) { +- return this.progressMap.getFloat(resourcekey); ++ public float dimensionProgress(ResourceKey<Level> level) { ++ return this.progressMap.getFloat(level); + } + + public float getProgress() { |