From 9b0e97b75b91c2ec1f94192562d310bd1c70c15a Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 15 Mar 2023 20:17:42 +0100 Subject: [PATCH] Update DataConverter --- patches/server/0009-MC-Utils.patch | 16 --- .../0015-Rewrite-dataconverter-system.patch | 106 ++++++++++++------ .../server/0018-Rewrite-chunk-system.patch | 14 +-- ...x-and-optimise-world-force-upgrading.patch | 8 +- 4 files changed, 83 insertions(+), 61 deletions(-) diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index bd58cc6a9c..cd3303b7f0 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -5446,22 +5446,6 @@ index b3e0495e0f242c96d4348438c0257c2045b801e5..c5fb6adb353538360ef420faee415656 } public static long getEpochMillis() { -diff --git a/src/main/java/net/minecraft/WorldVersion.java b/src/main/java/net/minecraft/WorldVersion.java -index 1357d732b0ee6ef923e537aad28d4ef6af18ab50..a3c526b6478508e3faa759c2e03e14c13a98e15b 100644 ---- a/src/main/java/net/minecraft/WorldVersion.java -+++ b/src/main/java/net/minecraft/WorldVersion.java -@@ -6,6 +6,11 @@ import net.minecraft.world.level.storage.DataVersion; - - public interface WorldVersion { - DataVersion getDataVersion(); -+ // Paper start -+ default int getWorldVersion() { -+ return this.getDataVersion().getVersion(); -+ } -+ // Paper end - - String getId(); - diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java index 819562d2c938fa05b8e8a00d1ae1f7c1fc9b00d5..4dffce4dc3434ef6adef7dc3cfac867ad89d9a5d 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java diff --git a/patches/server/0015-Rewrite-dataconverter-system.patch b/patches/server/0015-Rewrite-dataconverter-system.patch index 7ff6a856d7..eed4fbd0ae 100644 --- a/patches/server/0015-Rewrite-dataconverter-system.patch +++ b/patches/server/0015-Rewrite-dataconverter-system.patch @@ -196,7 +196,7 @@ index 0000000000000000000000000000000000000000..dde9d36bf6212196caa18f3c9c535aec +} diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java new file mode 100644 -index 0000000000000000000000000000000000000000..23377022e21db0fcd281652d8dea255e836e79e6 +index 0000000000000000000000000000000000000000..935a6de27ccde911ae95707b5b35d58bba8a3fd0 --- /dev/null +++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java @@ -0,0 +1,370 @@ @@ -409,7 +409,7 @@ index 0000000000000000000000000000000000000000..23377022e21db0fcd281652d8dea255e + 3214, + 3319, + 3322 -+ // All up to 1.19.4-pre1 ++ // All up to 1.19.4 + }; + Arrays.sort(converterVersions); + @@ -572,10 +572,10 @@ index 0000000000000000000000000000000000000000..23377022e21db0fcd281652d8dea255e +} diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersions.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersions.java new file mode 100644 -index 0000000000000000000000000000000000000000..fea3897437e6da9dfa0bb714c29d9f7002b92cd6 +index 0000000000000000000000000000000000000000..e8f11bd4b707f8276ceda29bd16058cb1861e79e --- /dev/null +++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersions.java -@@ -0,0 +1,450 @@ +@@ -0,0 +1,457 @@ +package ca.spottedleaf.dataconverter.minecraft; + +@SuppressWarnings("unused") @@ -1024,6 +1024,13 @@ index 0000000000000000000000000000000000000000..fea3897437e6da9dfa0bb714c29d9f70 + public static final int V23W06A = 3326; + public static final int V23W07A = 3329; + public static final int V1_19_4_PRE1 = 3330; ++ public static final int V1_19_4_PRE2 = 3331; ++ public static final int V1_19_4_PRE3 = 3332; ++ public static final int V1_19_4_PRE4 = 3333; ++ public static final int V1_19_4_RC1 = 3334; ++ public static final int V1_19_4_RC2 = 3335; ++ public static final int V1_19_4_RC3 = 3336; ++ public static final int V1_19_4 = 3337; + +} diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/advancements/ConverterAbstractAdvancementsRename.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/advancements/ConverterAbstractAdvancementsRename.java @@ -17885,16 +17892,19 @@ index 0000000000000000000000000000000000000000..7bda48947850559e5ccc92ea504a6499 +} diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3322.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3322.java new file mode 100644 -index 0000000000000000000000000000000000000000..b804325074c62744fd6d23d018a8bd6da9855951 +index 0000000000000000000000000000000000000000..5520dffc15f76a26fca3a26568b85a577cac255c --- /dev/null +++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3322.java -@@ -0,0 +1,76 @@ +@@ -0,0 +1,82 @@ +package ca.spottedleaf.dataconverter.minecraft.versions; + +import ca.spottedleaf.dataconverter.converters.DataConverter; +import ca.spottedleaf.dataconverter.minecraft.MCVersions; +import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry; ++import ca.spottedleaf.dataconverter.types.ListType; +import ca.spottedleaf.dataconverter.types.MapType; ++import ca.spottedleaf.dataconverter.types.ObjectType; ++ +import java.util.HashSet; +import java.util.Set; + @@ -17916,24 +17926,27 @@ index 0000000000000000000000000000000000000000..b804325074c62744fd6d23d018a8bd6d + return; + } + -+ final MapType data = root.getMap(path); ++ final ListType effects = root.getList(path, ObjectType.MAP); + -+ if (data == null) { ++ if (effects == null) { + return; + } + -+ final MapType factorData = data.getMap("FactorCalculationData"); -+ if (factorData == null) { -+ return; ++ for (int i = 0, len = effects.size(); i < len; ++i) { ++ final MapType data = effects.getMap(i); ++ final MapType factorData = data.getMap("FactorCalculationData"); ++ if (factorData == null) { ++ continue; ++ } ++ ++ final int timestamp = factorData.getInt("effect_changed_timestamp", -1); ++ factorData.remove("effect_changed_timestamp"); ++ ++ final int duration = data.getInt("Duration", -1); ++ ++ final int ticksActive = timestamp - duration; ++ factorData.setInt("ticks_active", ticksActive); + } -+ -+ final int timestamp = factorData.getInt("effect_changed_timestamp", -1); -+ factorData.remove("effect_changed_timestamp"); -+ -+ final int duration = data.getInt("Duration", -1); -+ -+ final int ticksActive = timestamp - duration; -+ factorData.setInt("ticks_active", ticksActive); + } + + public static void register() { @@ -18014,7 +18027,7 @@ index 0000000000000000000000000000000000000000..e9decfa3a1f819354d3b3e6a1cb09b91 +} diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3327.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3327.java new file mode 100644 -index 0000000000000000000000000000000000000000..40b8bf5583f130472bb61303a92783f9e5365253 +index 0000000000000000000000000000000000000000..a2d955a61d6496f19d2d4610057f8325618dfb0d --- /dev/null +++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3327.java @@ -0,0 +1,16 @@ @@ -18022,7 +18035,7 @@ index 0000000000000000000000000000000000000000..40b8bf5583f130472bb61303a92783f9 + +import ca.spottedleaf.dataconverter.minecraft.MCVersions; +import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry; -+import ca.spottedleaf.dataconverter.minecraft.walkers.itemstack.DataWalkerItemLists; ++import ca.spottedleaf.dataconverter.minecraft.walkers.generic.DataWalkerListPaths; +import ca.spottedleaf.dataconverter.minecraft.walkers.itemstack.DataWalkerItems; + +public final class V3327 { @@ -18030,16 +18043,16 @@ index 0000000000000000000000000000000000000000..40b8bf5583f130472bb61303a92783f9 + private static final int VERSION = MCVersions.V23W06A + 1; + + public static void register() { -+ MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:decorated_pot", new DataWalkerItemLists("shards")); ++ MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:decorated_pot", new DataWalkerListPaths<>(MCTypeRegistry.ITEM_NAME, "shards")); + MCTypeRegistry.TILE_ENTITY.addWalker(VERSION, "minecraft:suspicious_sand", new DataWalkerItems("item")); + } +} diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3328.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3328.java new file mode 100644 -index 0000000000000000000000000000000000000000..69674278a343ba44b55656b7105e9b7a731c6bc4 +index 0000000000000000000000000000000000000000..67218286c8e7896641b331118e7794bb6a6c835e --- /dev/null +++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3328.java -@@ -0,0 +1,14 @@ +@@ -0,0 +1,13 @@ +package ca.spottedleaf.dataconverter.minecraft.versions; + +import ca.spottedleaf.dataconverter.minecraft.MCVersions; @@ -18047,12 +18060,11 @@ index 0000000000000000000000000000000000000000..69674278a343ba44b55656b7105e9b7a + +public final class V3328 { + -+ private static final int VERSION = MCVersions.V23W06A + 1; ++ private static final int VERSION = MCVersions.V23W06A + 2; + + public static void register() { + // registers simple entity "minecraft:interaction" + } -+ +} diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V501.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V501.java new file mode 100644 @@ -23087,8 +23099,21 @@ index 0000000000000000000000000000000000000000..967ad1186cbc81a76a4958ea99d4eff3 + return correct.equals(value) ? null : correct; + } +} +diff --git a/src/main/java/net/minecraft/data/structures/StructureUpdater.java b/src/main/java/net/minecraft/data/structures/StructureUpdater.java +index d7ab56495d6f52e1dc16b1da82bb02c9187b947e..1babe9e3db4c57e8e54607bc962a64f49be2fcf4 100644 +--- a/src/main/java/net/minecraft/data/structures/StructureUpdater.java ++++ b/src/main/java/net/minecraft/data/structures/StructureUpdater.java +@@ -25,7 +25,7 @@ public class StructureUpdater implements SnbtToNbt.Filter { + LOGGER.warn("SNBT Too old, do not forget to update: {} < {}: {}", i, 3318, name); + } + +- CompoundTag compoundTag = DataFixTypes.STRUCTURE.updateToCurrentVersion(DataFixers.getDataFixer(), nbt, i); ++ CompoundTag compoundTag = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.STRUCTURE, nbt, i, net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper + structureTemplate.load(BuiltInRegistries.BLOCK.asLookup(), compoundTag); + return structureTemplate.save(new CompoundTag()); + } 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 61b00355b01fb5fb41ff1c02df7724b1af9a5441..4a298c0dc29e31bce79ca845883da1bc23da410d 100644 +index 61b00355b01fb5fb41ff1c02df7724b1af9a5441..ba267f3082607669282a61f013991e1c391a3f09 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 @@ -78,7 +78,7 @@ public class ChunkStorage implements AutoCloseable { @@ -23114,12 +23139,12 @@ index 61b00355b01fb5fb41ff1c02df7724b1af9a5441..4a298c0dc29e31bce79ca845883da1bc ChunkStorage.injectDatafixingContext(nbttagcompound, resourcekey, optional); - nbttagcompound = DataFixTypes.CHUNK.updateToCurrentVersion(this.fixerUpper, nbttagcompound, Math.max(1493, i)); -+ nbttagcompound = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, nbttagcompound, Math.max(1493, i), SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - replace chunk converter ++ nbttagcompound = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, nbttagcompound, Math.max(1493, i), SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper - replace chunk converter if (i < SharedConstants.getCurrentVersion().getDataVersion().getVersion()) { NbtUtils.addCurrentDataVersion(nbttagcompound); } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -index d80580574a9e5d1c850270d93807f3a66a9c76f8..2e9519726e5628a13a09f79dff2f5069fe5f2aa9 100644 +index d80580574a9e5d1c850270d93807f3a66a9c76f8..98b3909b536f11eda9c481ffd74066ad0cdb0ebc 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java @@ -115,7 +115,7 @@ public class EntityStorage implements EntityPersistentStorage { @@ -23127,7 +23152,7 @@ index d80580574a9e5d1c850270d93807f3a66a9c76f8..2e9519726e5628a13a09f79dff2f5069 private CompoundTag upgradeChunkTag(CompoundTag chunkNbt) { int i = NbtUtils.getDataVersion(chunkNbt, -1); - return DataFixTypes.ENTITY_CHUNK.updateToCurrentVersion(this.fixerUpper, chunkNbt, i); -+ return ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ENTITY_CHUNK, chunkNbt, i, net.minecraft.SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - route to new converter system ++ return ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ENTITY_CHUNK, chunkNbt, i, net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper - route to new converter system } @Override @@ -23152,7 +23177,7 @@ index 08961b2a9684ac54c455002affc6174b0e64b6a5..b0c8a0e64c7a5d41c1b4cc1e39c4399c for(int l = this.levelHeightAccessor.getMinSection(); l < this.levelHeightAccessor.getMaxSection(); ++l) { diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -index 15a9736a870055d639d03063c7cf67fd769fff36..ce2393c71dd405cb29509632119a945ade1c1038 100644 +index 15a9736a870055d639d03063c7cf67fd769fff36..1ca00340aaa201dd34e5c350d23ef53e126a0ca6 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java @@ -115,7 +115,7 @@ public class StructureCheck { @@ -23160,12 +23185,25 @@ index 15a9736a870055d639d03063c7cf67fd769fff36..ce2393c71dd405cb29509632119a945a CompoundTag compoundTag2; try { - compoundTag2 = DataFixTypes.CHUNK.updateToCurrentVersion(this.fixerUpper, compoundTag, i); -+ compoundTag2 = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, compoundTag, i, net.minecraft.SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - replace chunk converter ++ compoundTag2 = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.CHUNK, compoundTag, i, net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper - replace chunk converter } catch (Exception var12) { LOGGER.warn("Failed to partially datafix chunk {}", pos, var12); return StructureCheckResult.CHUNK_LOAD_NEEDED; +diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java +index 6ffca6d4ad2dbd26651760d2a8a5208689d5baf8..44b30217e549cda0b881e2799ffe8fbe06af2ce4 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java +@@ -235,7 +235,7 @@ public class StructureTemplateManager { + public StructureTemplate readStructure(CompoundTag nbt) { + StructureTemplate structureTemplate = new StructureTemplate(); + int i = NbtUtils.getDataVersion(nbt, 500); +- structureTemplate.load(this.blockLookup, DataFixTypes.STRUCTURE.updateToCurrentVersion(this.fixerUpper, nbt, i)); ++ ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.STRUCTURE, nbt, i, SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper + return structureTemplate; + } + diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java -index a5c67686f7c1be10d31601903e27d24e41cff83e..e0bb30446757045e89b227ff2f0136b371ca64cd 100644 +index a5c67686f7c1be10d31601903e27d24e41cff83e..e2c0ab0ab06b15dcfa6ce8c82ad4136f2be33b5c 100644 --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java @@ -93,7 +93,7 @@ public class PlayerDataStorage { @@ -23173,7 +23211,7 @@ index a5c67686f7c1be10d31601903e27d24e41cff83e..e0bb30446757045e89b227ff2f0136b3 int i = NbtUtils.getDataVersion(nbttagcompound, -1); - player.load(DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, nbttagcompound, i)); -+ player.load(ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER, nbttagcompound, i, net.minecraft.SharedConstants.getCurrentVersion().getWorldVersion())); // Paper - replace player converter ++ player.load(ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER, nbttagcompound, i, net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion())); // Paper - replace player converter } return nbttagcompound; diff --git a/patches/server/0018-Rewrite-chunk-system.patch b/patches/server/0018-Rewrite-chunk-system.patch index 74c18a5d3e..723e84af55 100644 --- a/patches/server/0018-Rewrite-chunk-system.patch +++ b/patches/server/0018-Rewrite-chunk-system.patch @@ -5140,7 +5140,7 @@ index 0000000000000000000000000000000000000000..0b7a2b0ead4f3bc07bfd9a38c2b7cf02 +} diff --git a/src/main/java/io/papermc/paper/chunk/system/poi/PoiChunk.java b/src/main/java/io/papermc/paper/chunk/system/poi/PoiChunk.java new file mode 100644 -index 0000000000000000000000000000000000000000..dc298e61e2d479801c8469b2067a8f8bcb076b1d +index 0000000000000000000000000000000000000000..d72041aa814ff179e6e29a45dcd359a91d426d47 --- /dev/null +++ b/src/main/java/io/papermc/paper/chunk/system/poi/PoiChunk.java @@ -0,0 +1,213 @@ @@ -5267,7 +5267,7 @@ index 0000000000000000000000000000000000000000..dc298e61e2d479801c8469b2067a8f8b + final CompoundTag sections = new CompoundTag(); + ret.put("Sections", sections); + -+ ret.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion()); ++ ret.putInt("DataVersion", SharedConstants.getCurrentVersion().getDataVersion().getVersion()); + + final ServerLevel world = this.world; + final PoiManager poiManager = world.getPoiManager(); @@ -6883,7 +6883,7 @@ index 0000000000000000000000000000000000000000..53ddd7e9ac05e6a9eb809f329796e6d4 +} diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkLoadTask.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkLoadTask.java new file mode 100644 -index 0000000000000000000000000000000000000000..3df793f7e6bb67f40e7387a72fdafb912a7b1373 +index 0000000000000000000000000000000000000000..be6f3f6a57668a9bd50d0ea5f2dd2335355b69d6 --- /dev/null +++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkLoadTask.java @@ -0,0 +1,499 @@ @@ -7306,7 +7306,7 @@ index 0000000000000000000000000000000000000000..3df793f7e6bb67f40e7387a72fdafb91 + // run converters + final int dataVersion = !data.contains(SharedConstants.DATA_VERSION_TAG, 99) ? 1945 : data.getInt(SharedConstants.DATA_VERSION_TAG); + final CompoundTag converted = MCDataConverter.convertTag( -+ MCTypeRegistry.POI_CHUNK, data, dataVersion, SharedConstants.getCurrentVersion().getWorldVersion() ++ MCTypeRegistry.POI_CHUNK, data, dataVersion, SharedConstants.getCurrentVersion().getDataVersion().getVersion() + ); + + // now we need to parse it @@ -17066,7 +17066,7 @@ index bca8084f7e76d036378705aa802217cc1bfdbc7d..f9dd2d9312297a727344d43150c5cab7 CompoundTag nbttagcompound3 = new CompoundTag(); Iterator iterator1 = chunk.getHeightmaps().iterator(); 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 4a298c0dc29e31bce79ca845883da1bc23da410d..35115f79825035ff28bdffa26ad4127fec8d05c1 100644 +index ba267f3082607669282a61f013991e1c391a3f09..0747d2d411a85a26bfea08cc1dd29df660620f67 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 @@ -28,26 +28,33 @@ import net.minecraft.world.level.storage.DimensionDataStorage; @@ -17194,7 +17194,7 @@ index 4a298c0dc29e31bce79ca845883da1bc23da410d..35115f79825035ff28bdffa26ad4127f } } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -index 2e9519726e5628a13a09f79dff2f5069fe5f2aa9..340e2f789d3cacb5b87839e13f476149bc47583f 100644 +index 98b3909b536f11eda9c481ffd74066ad0cdb0ebc..0ec0be22f7292d57c40da6f1f4575bdebf8dbd09 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java @@ -30,43 +30,31 @@ public class EntityStorage implements EntityPersistentStorage { @@ -17341,7 +17341,7 @@ index 2e9519726e5628a13a09f79dff2f5069fe5f2aa9..340e2f789d3cacb5b87839e13f476149 - private CompoundTag upgradeChunkTag(CompoundTag chunkNbt) { + public static CompoundTag upgradeChunkTag(CompoundTag chunkNbt) { // Paper - public and static int i = NbtUtils.getDataVersion(chunkNbt, -1); - return ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ENTITY_CHUNK, chunkNbt, i, net.minecraft.SharedConstants.getCurrentVersion().getWorldVersion()); // Paper - route to new converter system + return ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ENTITY_CHUNK, chunkNbt, i, net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper - route to new converter system } @Override diff --git a/patches/server/0621-Fix-and-optimise-world-force-upgrading.patch b/patches/server/0621-Fix-and-optimise-world-force-upgrading.patch index b4483945a5..2ad8bec1ec 100644 --- a/patches/server/0621-Fix-and-optimise-world-force-upgrading.patch +++ b/patches/server/0621-Fix-and-optimise-world-force-upgrading.patch @@ -33,7 +33,7 @@ public net.minecraft.util.worldupdate.WorldUpgrader REGEX diff --git a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java new file mode 100644 -index 0000000000000000000000000000000000000000..95cac7edae8ac64811fc6a2f6b97dd4a0fceb0b0 +index 0000000000000000000000000000000000000000..513833c2ea23df5b079d157bc5cb89d5c9754c0b --- /dev/null +++ b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java @@ -0,0 +1,209 @@ @@ -222,7 +222,7 @@ index 0000000000000000000000000000000000000000..95cac7edae8ac64811fc6a2f6b97dd4a + + chunkNBT = loader.upgradeChunkTag(worldKey, persistentDataSupplier, chunkNBT, this.worldInfo.generatorKey, chunkPos, null); + -+ boolean modified = versionBefore < SharedConstants.getCurrentVersion().getWorldVersion(); ++ boolean modified = versionBefore < SharedConstants.getCurrentVersion().getDataVersion().getVersion(); + + if (removeCaches) { + final CompoundTag level = chunkNBT.getCompound("Level"); @@ -275,7 +275,7 @@ index 13e5362e12eb857b0cc27277c95efe085e77348d..1619da8a904785e0cc00ddbcfba1c3fa Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, dimensionOptionsRegistry, eraseCache); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ff97f603d9962dba69f1ae06d2a25986d2354927..7e4e484539ad705d61cd0d1b4db49e31fe3ca8f7 100644 +index 3587d9a74ecd622789b16752ec87391ad7d68053..b9ef06e2ba2e9842a0b4d66976b703918f585752 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -553,11 +553,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop