3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00

Update Datafixer

Dieser Commit ist enthalten in:
Nassim Jahnke 2022-02-28 23:21:15 +01:00 committet von Jason Penilla
Ursprung f4eb08a477
Commit 706c98a603
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0E75A301420E48F8

Datei anzeigen

@ -207,21 +207,21 @@ index 0000000000000000000000000000000000000000..25f1f4c355c1b4aca12e366f100922c5
+}
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..016420effa89f3243479a966bf7aed286e82be1c
index 0000000000000000000000000000000000000000..44fa4eb2030242fc8d22c616c5d2f42bdfe96198
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java
@@ -0,0 +1,343 @@
@@ -0,0 +1,346 @@
+package ca.spottedleaf.dataconverter.minecraft;
+
+import ca.spottedleaf.dataconverter.converters.DataConverter;
+import com.mojang.logging.LogUtils;
+import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap;
+import it.unimi.dsi.fastutil.ints.IntArrayList;
+import it.unimi.dsi.fastutil.ints.IntLinkedOpenHashSet;
+import it.unimi.dsi.fastutil.ints.IntRBTreeSet;
+import it.unimi.dsi.fastutil.longs.LongArrayList;
+import it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.slf4j.Logger;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Comparator;
@ -229,7 +229,7 @@ index 0000000000000000000000000000000000000000..016420effa89f3243479a966bf7aed28
+
+public final class MCVersionRegistry {
+
+ private static final Logger LOGGER = LogManager.getLogger();
+ private static final Logger LOGGER = LogUtils.getLogger();
+
+ protected static final Int2ObjectLinkedOpenHashMap<String> VERSION_NAMES = new Int2ObjectLinkedOpenHashMap<>();
+ protected static final IntArrayList VERSION_LIST;
@ -325,6 +325,7 @@ index 0000000000000000000000000000000000000000..016420effa89f3243479a966bf7aed28
+ 1906,
+ 1909,
+ 1911,
+ 1914,
+ 1917,
+ 1918,
+ 1920,
@ -396,7 +397,9 @@ index 0000000000000000000000000000000000000000..016420effa89f3243479a966bf7aed28
+ 2843,
+ 2846,
+ 2852,
+ // All up to 1.18-pre6
+ 2967,
+ 2970
+ // All up to 1.18.2-pre1
+ };
+ Arrays.sort(converterVersions);
+
@ -556,10 +559,10 @@ index 0000000000000000000000000000000000000000..016420effa89f3243479a966bf7aed28
+}
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..ba8c1f056aa77d3812fb02f2a60ddd192e68984f
index 0000000000000000000000000000000000000000..5957de996f4fa1a30ec16c7d6e377b1fabd0eb2f
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersions.java
@@ -0,0 +1,380 @@
@@ -0,0 +1,397 @@
+package ca.spottedleaf.dataconverter.minecraft;
+
+@SuppressWarnings("unused")
@ -939,6 +942,23 @@ index 0000000000000000000000000000000000000000..ba8c1f056aa77d3812fb02f2a60ddd19
+ public static final int V1_18_PRE4 = 2850;
+ public static final int V1_18_PRE5 = 2851;
+ public static final int V1_18_PRE6 = 2853;
+ public static final int V1_18_PRE7 = 2854;
+ public static final int V1_18_PRE8 = 2855;
+ public static final int V1_18_RC1 = 2856;
+ public static final int V1_18_RC2 = 2857;
+ public static final int V1_18_RC3 = 2858;
+ public static final int V1_18_RC4 = 2859;
+ public static final int V1_18 = 2860;
+ public static final int V1_18_1_PRE1 = 2861;
+ public static final int V1_18_1_RC1 = 2862;
+ public static final int V1_18_1_RC2 = 2863;
+ public static final int V1_18_1_RC3 = 2864;
+ public static final int V1_18_1 = 2865;
+ public static final int V22W03A = 2966;
+ public static final int V22W05A = 2967;
+ public static final int V22W06A = 2968;
+ public static final int V22W07A = 2969;
+ public static final int V1_18_2_PRE1 = 2971;
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/ReplacedDataFixerUpper.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/ReplacedDataFixerUpper.java
new file mode 100644
@ -1201,7 +1221,7 @@ index 0000000000000000000000000000000000000000..ba9daaab1abd53a3fbdebd78e05ba363
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/chunk/ConverterFlattenChunk.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/chunk/ConverterFlattenChunk.java
new file mode 100644
index 0000000000000000000000000000000000000000..64226434a38dc5e4a9103c61aa8f9c20bce9550c
index 0000000000000000000000000000000000000000..300c2d14818b1e0cfe7341aba573ec75d0581b26
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/chunk/ConverterFlattenChunk.java
@@ -0,0 +1,1016 @@
@ -1216,6 +1236,7 @@ index 0000000000000000000000000000000000000000..64226434a38dc5e4a9103c61aa8f9c20
+import ca.spottedleaf.dataconverter.types.ObjectType;
+import ca.spottedleaf.dataconverter.types.Types;
+import com.mojang.datafixers.DataFixUtils;
+import com.mojang.logging.LogUtils;
+import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap;
+import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
@ -1223,8 +1244,7 @@ index 0000000000000000000000000000000000000000..64226434a38dc5e4a9103c61aa8f9c20
+import it.unimi.dsi.fastutil.ints.IntIterator;
+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
+import net.minecraft.util.datafix.PackedBitStorage;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.slf4j.Logger;
+import java.util.Arrays;
+import java.util.BitSet;
+import java.util.HashMap;
@ -1236,7 +1256,7 @@ index 0000000000000000000000000000000000000000..64226434a38dc5e4a9103c61aa8f9c20
+
+public final class ConverterFlattenChunk extends DataConverter<MapType<String>, MapType<String>> {
+
+ private static final Logger LOGGER = LogManager.getLogger();
+ private static final Logger LOGGER = LogUtils.getLogger();
+
+ static final BitSet VIRTUAL_SET = new BitSet(256);
+ static final BitSet IDS_NEEDING_FIX_SET = new BitSet(256);
@ -5291,19 +5311,18 @@ index 0000000000000000000000000000000000000000..94569f0ccff0d3a09eafd4ba73572d9d
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/itemstack/ConverterFlattenItemStack.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/itemstack/ConverterFlattenItemStack.java
new file mode 100644
index 0000000000000000000000000000000000000000..48a1fdd4e8a9ba334ff264820b20e5f4224b3ce6
index 0000000000000000000000000000000000000000..21176b8b96be6cb93d3dc1a74ae9f53f1ad4740c
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/itemstack/ConverterFlattenItemStack.java
@@ -0,0 +1,461 @@
@@ -0,0 +1,460 @@
+package ca.spottedleaf.dataconverter.minecraft.converters.itemstack;
+
+import ca.spottedleaf.dataconverter.converters.DataConverter;
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
+import ca.spottedleaf.dataconverter.types.MapType;
+import ca.spottedleaf.dataconverter.types.Types;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import com.mojang.logging.LogUtils;
+import org.slf4j.Logger;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
@ -5312,7 +5331,7 @@ index 0000000000000000000000000000000000000000..48a1fdd4e8a9ba334ff264820b20e5f4
+
+public final class ConverterFlattenItemStack extends DataConverter<MapType<String>, MapType<String>> {
+
+ private static final Logger LOGGER = LogManager.getLogger();
+ private static final Logger LOGGER = LogUtils.getLogger();
+
+ // Map of "id.damage" -> "flattened id"
+ private static final Map<String, String> FLATTEN_MAP = new HashMap<>();
@ -6443,10 +6462,10 @@ index 0000000000000000000000000000000000000000..76a6e3efa5c69150e8f5e0063cb6357b
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java
new file mode 100644
index 0000000000000000000000000000000000000000..40fa4f9b8ad8c658ec43e1b4a9d3dec7de4744da
index 0000000000000000000000000000000000000000..c6bc771b2f8bd527d5d14cb04139607868df8f93
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java
@@ -0,0 +1,339 @@
@@ -0,0 +1,360 @@
+package ca.spottedleaf.dataconverter.minecraft.datatypes;
+
+import ca.spottedleaf.dataconverter.minecraft.versions.V100;
@ -6503,6 +6522,7 @@ index 0000000000000000000000000000000000000000..40fa4f9b8ad8c658ec43e1b4a9d3dec7
+import ca.spottedleaf.dataconverter.minecraft.versions.V1905;
+import ca.spottedleaf.dataconverter.minecraft.versions.V1906;
+import ca.spottedleaf.dataconverter.minecraft.versions.V1911;
+import ca.spottedleaf.dataconverter.minecraft.versions.V1914;
+import ca.spottedleaf.dataconverter.minecraft.versions.V1917;
+import ca.spottedleaf.dataconverter.minecraft.versions.V1918;
+import ca.spottedleaf.dataconverter.minecraft.versions.V1920;
@ -6572,6 +6592,8 @@ index 0000000000000000000000000000000000000000..40fa4f9b8ad8c658ec43e1b4a9d3dec7
+import ca.spottedleaf.dataconverter.minecraft.versions.V2843;
+import ca.spottedleaf.dataconverter.minecraft.versions.V2846;
+import ca.spottedleaf.dataconverter.minecraft.versions.V2852;
+import ca.spottedleaf.dataconverter.minecraft.versions.V2967;
+import ca.spottedleaf.dataconverter.minecraft.versions.V2970;
+import ca.spottedleaf.dataconverter.minecraft.versions.V501;
+import ca.spottedleaf.dataconverter.minecraft.versions.V502;
+import ca.spottedleaf.dataconverter.minecraft.versions.V505;
@ -6588,9 +6610,13 @@ index 0000000000000000000000000000000000000000..40fa4f9b8ad8c658ec43e1b4a9d3dec7
+import ca.spottedleaf.dataconverter.minecraft.versions.V816;
+import ca.spottedleaf.dataconverter.minecraft.versions.V820;
+import ca.spottedleaf.dataconverter.minecraft.versions.V99;
+import com.mojang.logging.LogUtils;
+import org.slf4j.Logger;
+
+public final class MCTypeRegistry {
+
+ private static final Logger LOGGER = LogUtils.getLogger();
+
+ public static final MCDataType LEVEL = new MCDataType("Level");
+ public static final MCDataType PLAYER = new MCDataType("Player");
+ public static final MCDataType CHUNK = new MCDataType("Chunk");
@ -6618,6 +6644,17 @@ index 0000000000000000000000000000000000000000..40fa4f9b8ad8c658ec43e1b4a9d3dec7
+ public static final MCDataType WORLD_GEN_SETTINGS = new MCDataType("WorldGenSettings");
+
+ static {
+ try {
+ registerAll();
+ } catch (final ThreadDeath thr) {
+ throw thr;
+ } catch (final Throwable thr) {
+ LOGGER.error(LogUtils.FATAL_MARKER, "Failed to register data converters", thr);
+ throw new RuntimeException(thr);
+ }
+ }
+
+ private static void registerAll() {
+ // General notes:
+ // - Structure converters run before everything.
+ // - ID specific converters run after structure converters.
@ -6703,6 +6740,7 @@ index 0000000000000000000000000000000000000000..40fa4f9b8ad8c658ec43e1b4a9d3dec7
+ V1906.register();
+ // V1909 is just adding a simple block entity (jigsaw)
+ V1911.register();
+ V1914.register();
+ V1917.register();
+ V1918.register();
+ V1920.register();
@ -6782,6 +6820,8 @@ index 0000000000000000000000000000000000000000..40fa4f9b8ad8c658ec43e1b4a9d3dec7
+ V2843.register();
+ V2846.register();
+ V2852.register();
+ V2967.register();
+ V2970.register();
+ }
+
+ private MCTypeRegistry() {}
@ -7191,7 +7231,7 @@ index 0000000000000000000000000000000000000000..f91caab4432c87238d6ac2453068bb2e
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V102.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V102.java
new file mode 100644
index 0000000000000000000000000000000000000000..660134f3fdc8db11033b310dbf52aed328bf4d99
index 0000000000000000000000000000000000000000..76374ca99efdf898dee0829fd8eb5fac26dc9a22
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V102.java
@@ -0,0 +1,87 @@
@ -7204,12 +7244,12 @@ index 0000000000000000000000000000000000000000..660134f3fdc8db11033b310dbf52aed3
+import ca.spottedleaf.dataconverter.types.ObjectType;
+import ca.spottedleaf.dataconverter.types.MapType;
+import ca.spottedleaf.dataconverter.types.Types;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import com.mojang.logging.LogUtils;
+import org.slf4j.Logger;
+
+public final class V102 {
+
+ private static final Logger LOGGER = LogManager.getLogger();
+ private static final Logger LOGGER = LogUtils.getLogger();
+
+ protected static final int VERSION = MCVersions.V15W32A + 2;
+
@ -7530,23 +7570,24 @@ index 0000000000000000000000000000000000000000..aa8c8d22ee2a77604d923b62f5a93ede
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V108.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V108.java
new file mode 100644
index 0000000000000000000000000000000000000000..2300f4db851510cfa3b8dd704b555e12bc4ea725
index 0000000000000000000000000000000000000000..6bc4e2939bd26538492a7b94b743957d56ddc575
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V108.java
@@ -0,0 +1,47 @@
@@ -0,0 +1,48 @@
+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.MapType;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import com.mojang.logging.LogUtils;
+import org.slf4j.Logger;
+
+import java.util.UUID;
+
+public final class V108 {
+
+ private static final Logger LOGGER = LogManager.getLogger();
+ private static final Logger LOGGER = LogUtils.getLogger();
+
+ protected static final int VERSION = MCVersions.V15W32C + 4;
+
@ -10923,7 +10964,7 @@ index 0000000000000000000000000000000000000000..8f7a2ff2d5a154f667da35215f0e1d07
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1624.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1624.java
new file mode 100644
index 0000000000000000000000000000000000000000..fc236f356067295a74e6d74e5e10ac099fc8ffa4
index 0000000000000000000000000000000000000000..7b304031e1e8af120c6535e599c2ee4fdbce1682
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1624.java
@@ -0,0 +1,110 @@
@ -10935,13 +10976,13 @@ index 0000000000000000000000000000000000000000..fc236f356067295a74e6d74e5e10ac09
+import ca.spottedleaf.dataconverter.types.ListType;
+import ca.spottedleaf.dataconverter.types.MapType;
+import ca.spottedleaf.dataconverter.types.ObjectType;
+import com.mojang.logging.LogUtils;
+import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.slf4j.Logger;
+
+public final class V1624 {
+
+ private static final Logger LOGGER = LogManager.getLogger();
+ private static final Logger LOGGER = LogUtils.getLogger();
+
+ protected static final int VERSION = MCVersions.V18W32A + 1;
+
@ -11445,6 +11486,39 @@ index 0000000000000000000000000000000000000000..b9cc2e4a2ae42e12ccf4e0b634fd74d3
+ }
+
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1914.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1914.java
new file mode 100644
index 0000000000000000000000000000000000000000..8f5a48c4824080827d2dad057ae70dfd7a11818f
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1914.java
@@ -0,0 +1,27 @@
+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.MapType;
+
+public final class V1914 {
+
+ protected static final int VERSION = MCVersions.V18W48A;
+
+ public static void register() {
+ MCTypeRegistry.TILE_ENTITY.addConverterForId("minecraft:chest", new DataConverter<>(VERSION) {
+ @Override
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ final String lootTable = data.getString("LootTable");
+
+ if ("minecraft:chests/village_blacksmith".equals(lootTable)) {
+ data.setString("LootTable", "minecraft:chests/village/village_weaponsmith");
+ }
+
+ return null;
+ }
+ });
+ }
+
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1917.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V1917.java
new file mode 100644
index 0000000000000000000000000000000000000000..71538d858a681c91f7193003e0808cdb4fd1f847
@ -15313,7 +15387,7 @@ index 0000000000000000000000000000000000000000..d28ade80499dce882a9a84309a2a0da5
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2832.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2832.java
new file mode 100644
index 0000000000000000000000000000000000000000..b1049823fc2ff1c8183f4664ff4d40da6495f9ee
index 0000000000000000000000000000000000000000..95a306d6cc5b4ac8161d5bed80b6a7073b3e914e
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2832.java
@@ -0,0 +1,920 @@
@ -15328,12 +15402,12 @@ index 0000000000000000000000000000000000000000..b1049823fc2ff1c8183f4664ff4d40da
+import ca.spottedleaf.dataconverter.types.MapType;
+import ca.spottedleaf.dataconverter.types.ObjectType;
+import ca.spottedleaf.dataconverter.types.Types;
+import com.mojang.logging.LogUtils;
+import it.unimi.dsi.fastutil.ints.Int2IntLinkedOpenHashMap;
+import it.unimi.dsi.fastutil.ints.IntIterator;
+import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
+import org.apache.commons.lang3.mutable.MutableBoolean;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.slf4j.Logger;
+import java.util.Arrays;
+import java.util.BitSet;
+import java.util.HashSet;
@ -15341,7 +15415,7 @@ index 0000000000000000000000000000000000000000..b1049823fc2ff1c8183f4664ff4d40da
+
+public final class V2832 {
+
+ protected static final Logger LOGGER = LogManager.getLogger();
+ private static final Logger LOGGER = LogUtils.getLogger();
+
+ protected static final int VERSION = MCVersions.V1_17_1 + 102;
+
@ -15600,7 +15674,7 @@ index 0000000000000000000000000000000000000000..b1049823fc2ff1c8183f4664ff4d40da
+ try {
+ section.setLongs("BlockStates", resize(blockStates, gotBits, expectedBits));
+ } catch (final Exception ex) {
+ LOGGER.fatal("Failed to rewrite mismatched palette and data storage for section y: " + sectionY
+ LOGGER.error("Failed to rewrite mismatched palette and data storage for section y: " + sectionY
+ + " for chunk [" + chunkX + "," + chunkZ + "], palette entries: " + palette.size() + ", data storage size: "
+ + blockStates.length,
+ ex
@ -16630,15 +16704,21 @@ index 0000000000000000000000000000000000000000..f06e24bb87baf01b1386fb7a6af1ea04
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2843.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2843.java
new file mode 100644
index 0000000000000000000000000000000000000000..5d69a84a1d4f74a961210561c3258a4ed5e4c4d2
index 0000000000000000000000000000000000000000..6333eabb123f13495f7a828fe79c204aff9dcedd
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2843.java
@@ -0,0 +1,15 @@
@@ -0,0 +1,105 @@
+package ca.spottedleaf.dataconverter.minecraft.versions;
+
+import ca.spottedleaf.dataconverter.converters.DataConverter;
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
+import ca.spottedleaf.dataconverter.minecraft.converters.helpers.ConverterAbstractStringValueTypeRename;
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
+import ca.spottedleaf.dataconverter.minecraft.walkers.generic.WalkerUtils;
+import ca.spottedleaf.dataconverter.types.ListType;
+import ca.spottedleaf.dataconverter.types.MapType;
+import ca.spottedleaf.dataconverter.types.ObjectType;
+import ca.spottedleaf.dataconverter.types.Types;
+import java.util.Map;
+
+public final class V2843 {
@ -16647,6 +16727,90 @@ index 0000000000000000000000000000000000000000..5d69a84a1d4f74a961210561c3258a4e
+
+ public static void register() {
+ ConverterAbstractStringValueTypeRename.register(VERSION, MCTypeRegistry.BIOME, Map.of("minecraft:deep_warm_ocean", "minecraft:warm_ocean")::get);
+
+ MCTypeRegistry.CHUNK.addStructureConverter(new DataConverter<>(VERSION) {
+ private static void moveOutOfBoundTicks(final ListType ticks, final MapType<String> chunkRoot, final int chunkX, final int chunkZ, final String intoKey) {
+ if (ticks == null) {
+ return;
+ }
+
+ ListType outOfBounds = null;
+ for (int i = 0, len = ticks.size(); i < len; ++i) {
+ final MapType<String> tick = ticks.getMap(i);
+ final int x = tick.getInt("x");
+ final int z = tick.getInt("z");
+ // anything > 1 is lost, anything less than 1 stays.
+ if (Math.max(Math.abs(chunkX - (x >> 4)), Math.abs(chunkZ - (z >> 4))) == 1) {
+ // DFU doesn't remove, so neither do we.
+ if (outOfBounds == null) {
+ outOfBounds = Types.NBT.createEmptyList();
+ }
+ outOfBounds.addMap(tick);
+ }
+ }
+
+ if (outOfBounds != null) {
+ MapType<String> upgradeData = chunkRoot.getMap("UpgradeData");
+ if (upgradeData == null) {
+ chunkRoot.setMap("UpgradeData", upgradeData = Types.NBT.createEmptyMap());
+ }
+ upgradeData.setList(intoKey, outOfBounds);
+ }
+ }
+
+ @Override
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ // After renames, so use new names
+ final int x = data.getInt("xPos");
+ final int z = data.getInt("zPos");
+
+ moveOutOfBoundTicks(data.getList("block_ticks", ObjectType.MAP), data, x, z, "neighbor_block_ticks");
+ moveOutOfBoundTicks(data.getList("fluid_ticks", ObjectType.MAP), data, x, z, "neighbor_fluid_ticks");
+
+ return null;
+ }
+ });
+
+ // DFU is missing schema for UpgradeData block names
+ MCTypeRegistry.CHUNK.addStructureWalker(VERSION, (final MapType<String> data, final long fromVersion, final long toVersion) -> {
+ WalkerUtils.convertList(MCTypeRegistry.ENTITY, data, "entities", fromVersion, toVersion);
+ WalkerUtils.convertList(MCTypeRegistry.TILE_ENTITY, data, "block_entities", fromVersion, toVersion);
+
+ final ListType blockTicks = data.getList("block_ticks", ObjectType.MAP);
+ if (blockTicks != null) {
+ for (int i = 0, len = blockTicks.size(); i < len; ++i) {
+ WalkerUtils.convert(MCTypeRegistry.BLOCK_NAME, blockTicks.getMap(i), "i", fromVersion, toVersion);
+ }
+ }
+
+ final MapType<String> upgradeData = data.getMap("UpgradeData");
+ if (upgradeData != null) {
+ // Even though UpgradeData will retrieve the block from the World when the type no longer exists,
+ // the type from the world may not match what was actually queued. So, even though it may look like we
+ // can skip the walker here, we actually don't if we want to be thorough.
+ final ListType neighbourBlockTicks = upgradeData.getList("neighbor_block_ticks", ObjectType.MAP);
+ if (neighbourBlockTicks != null) {
+ for (int i = 0, len = neighbourBlockTicks.size(); i < len; ++i) {
+ WalkerUtils.convert(MCTypeRegistry.BLOCK_NAME, neighbourBlockTicks.getMap(i), "i", fromVersion, toVersion);
+ }
+ }
+ }
+
+ final ListType sections = data.getList("sections", ObjectType.MAP);
+ if (sections != null) {
+ for (int i = 0, len = sections.size(); i < len; ++i) {
+ final MapType<String> section = sections.getMap(i);
+
+ WalkerUtils.convertList(MCTypeRegistry.BIOME, section.getMap("biomes"), "palette", fromVersion, toVersion);
+ WalkerUtils.convertList(MCTypeRegistry.BLOCK_STATE, section.getMap("block_states"), "palette", fromVersion, toVersion);
+ }
+ }
+
+ WalkerUtils.convertValues(MCTypeRegistry.STRUCTURE_FEATURE, data.getMap("structures"), "starts", fromVersion, toVersion);
+
+ return null;
+ });
+
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2846.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2846.java
@ -16708,6 +16872,266 @@ index 0000000000000000000000000000000000000000..94ab7be8c34d2ebb557df5a0864130f7
+ });
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2967.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2967.java
new file mode 100644
index 0000000000000000000000000000000000000000..7af7bf450080f65b8b7d7a8d2f941846c029e504
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2967.java
@@ -0,0 +1,56 @@
+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.MapType;
+
+public final class V2967 {
+
+ protected static final int VERSION = MCVersions.V22W05A;
+
+ public static void register() {
+ MCTypeRegistry.WORLD_GEN_SETTINGS.addStructureConverter(new DataConverter<>(VERSION) {
+ @Override
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ final MapType<String> dimensions = data.getMap("dimensions");
+
+ if (dimensions == null) {
+ return null;
+ }
+
+ for (final String dimension : dimensions.keys()) {
+ final MapType<String> dimensionData = dimensions.getMap(dimension);
+ if (dimensionData == null) {
+ continue;
+ }
+
+ final MapType<String> generator = dimensionData.getMap("generator");
+ if (generator == null) {
+ continue;
+ }
+
+ final MapType<String> settings = generator.getMap("settings");
+ if (settings == null) {
+ continue;
+ }
+
+ final MapType<String> structures = settings.getMap("structures");
+ if (structures == null) {
+ continue;
+ }
+
+ for (final String structureKey : structures.keys()) {
+ structures.getMap(structureKey).setString("type", "minecraft:random_spread");
+ }
+
+ final MapType<String> stronghold = structures.getMap("stronghold");
+ stronghold.setString("type", "minecraft:concentric_rings");
+ structures.setMap("minecraft:stronghold", stronghold.copy());
+ }
+
+ return null;
+ }
+ });
+ }
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2970.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2970.java
new file mode 100644
index 0000000000000000000000000000000000000000..fa824cdf629caec745eff7c09eb4570c62263752
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V2970.java
@@ -0,0 +1,192 @@
+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 ca.spottedleaf.dataconverter.types.Types;
+import com.google.common.collect.ImmutableMap;
+import it.unimi.dsi.fastutil.objects.Object2IntMap;
+import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+public final class V2970 {
+
+ protected static final int VERSION = MCVersions.V22W07A + 1;
+ private static final Map<String, BiomeRemap> CONVERSION_MAP = new HashMap<>(
+ ImmutableMap.<String, BiomeRemap>builder()
+ .put("mineshaft", BiomeRemap.create(Map.of(List.of("minecraft:badlands", "minecraft:eroded_badlands", "minecraft:wooded_badlands"), "minecraft:mineshaft_mesa"), "minecraft:mineshaft"))
+ .put("shipwreck", BiomeRemap.create(Map.of(List.of("minecraft:beach", "minecraft:snowy_beach"), "minecraft:shipwreck_beached"), "minecraft:shipwreck"))
+ .put("ocean_ruin", BiomeRemap.create(Map.of(List.of("minecraft:warm_ocean", "minecraft:lukewarm_ocean", "minecraft:deep_lukewarm_ocean"), "minecraft:ocean_ruin_warm"), "minecraft:ocean_ruin_cold"))
+ .put("village", BiomeRemap.create(Map.of(List.of("minecraft:desert"), "minecraft:village_desert", List.of("minecraft:savanna"), "minecraft:village_savanna", List.of("minecraft:snowy_plains"), "minecraft:village_snowy", List.of("minecraft:taiga"), "minecraft:village_taiga"), "minecraft:village_plains"))
+ .put("ruined_portal", BiomeRemap.create(Map.of(List.of("minecraft:desert"), "minecraft:ruined_portal_desert", List.of("minecraft:badlands", "minecraft:eroded_badlands", "minecraft:wooded_badlands", "minecraft:windswept_hills", "minecraft:windswept_forest", "minecraft:windswept_gravelly_hills", "minecraft:savanna_plateau", "minecraft:windswept_savanna", "minecraft:stony_shore", "minecraft:meadow", "minecraft:frozen_peaks", "minecraft:jagged_peaks", "minecraft:stony_peaks", "minecraft:snowy_slopes"), "minecraft:ruined_portal_mountain", List.of("minecraft:bamboo_jungle", "minecraft:jungle", "minecraft:sparse_jungle"), "minecraft:ruined_portal_jungle", List.of("minecraft:deep_frozen_ocean", "minecraft:deep_cold_ocean", "minecraft:deep_ocean", "minecraft:deep_lukewarm_ocean", "minecraft:frozen_ocean", "minecraft:ocean", "minecraft:cold_ocean", "minecraft:lukewarm_ocean", "minecraft:warm_ocean"), "minecraft:ruined_portal_ocean"), "minecraft:ruined_portal")) // Fix MC-248814, ruined_portal_standard->ruined_portal
+ .put("pillager_outpost", BiomeRemap.create("minecraft:pillager_outpost"))
+ .put("mansion", BiomeRemap.create("minecraft:mansion"))
+ .put("jungle_pyramid", BiomeRemap.create("minecraft:jungle_pyramid"))
+ .put("desert_pyramid", BiomeRemap.create("minecraft:desert_pyramid"))
+ .put("igloo", BiomeRemap.create("minecraft:igloo"))
+ .put("swamp_hut", BiomeRemap.create("minecraft:swamp_hut"))
+ .put("stronghold", BiomeRemap.create("minecraft:stronghold"))
+ .put("monument", BiomeRemap.create("minecraft:monument"))
+ .put("fortress", BiomeRemap.create("minecraft:fortress"))
+ .put("endcity", BiomeRemap.create("minecraft:end_city"))
+ .put("buried_treasure", BiomeRemap.create("minecraft:buried_treasure"))
+ .put("nether_fossil", BiomeRemap.create("minecraft:nether_fossil"))
+ .put("bastion_remnant", BiomeRemap.create("minecraft:bastion_remnant"))
+ .build()
+ );
+
+ public static void register() {
+ MCTypeRegistry.CHUNK.addStructureConverter(new DataConverter<>(VERSION) {
+ private static Object2IntOpenHashMap<String> countBiomes(final MapType<String> chunk) {
+ final ListType sections = chunk.getList("sections", ObjectType.MAP);
+ if (sections == null) {
+ return null;
+ }
+
+ final Object2IntOpenHashMap<String> ret = new Object2IntOpenHashMap<>();
+
+ for (int i = 0, len = sections.size(); i < len; ++i) {
+ final MapType<String> section = sections.getMap(i);
+
+ final MapType<String> biomes = section.getMap("biomes");
+
+ if (biomes == null) {
+ continue;
+ }
+
+ final ListType palette = biomes.getList("palette", ObjectType.STRING);
+
+ if (palette == null) {
+ continue;
+ }
+
+ for (int k = 0, len2 = palette.size(); k < len2; ++k) {
+ ret.addTo(palette.getString(k), 1);
+ }
+ }
+
+ return ret;
+ }
+
+ private static String getStructureConverted(String id, final Object2IntOpenHashMap<String> biomeCount) {
+ id = id.toLowerCase(Locale.ROOT);
+ final BiomeRemap remap = CONVERSION_MAP.get(id);
+ if (remap == null) {
+ throw new IllegalArgumentException("Unknown structure " + id);
+ }
+ if (remap.biomeToNewStructure == null || biomeCount == null) {
+ return remap.dfl;
+ }
+
+ final Object2IntOpenHashMap<String> remapCount = new Object2IntOpenHashMap<>();
+
+ for (final Iterator<Object2IntMap.Entry<String>> iterator = biomeCount.object2IntEntrySet().fastIterator(); iterator.hasNext();) {
+ final Object2IntMap.Entry<String> entry = iterator.next();
+ final String remappedStructure = remap.biomeToNewStructure.get(entry.getKey());
+ if (remappedStructure != null) {
+ remapCount.addTo(remappedStructure, entry.getIntValue());
+ }
+ }
+
+ String converted = remap.dfl;
+ int maxCount = 0;
+
+ for (final Iterator<Object2IntMap.Entry<String>> iterator = remapCount.object2IntEntrySet().fastIterator(); iterator.hasNext();) {
+ final Object2IntMap.Entry<String> entry = iterator.next();
+ final int count = entry.getIntValue();
+ if (count > maxCount) {
+ maxCount = count;
+ converted = entry.getKey();
+ }
+ }
+
+ return converted;
+ }
+
+ @Override
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
+ final MapType<String> structures = data.getMap("structures");
+ if (structures == null || structures.isEmpty()) {
+ return null;
+ }
+
+ final Object2IntOpenHashMap<String> biomeCounts = countBiomes(data);
+
+ final MapType<String> starts = structures.getMap("starts");
+ final MapType<String> references = structures.getMap("References");
+
+ if (starts != null) {
+ final MapType<String> newStarts = Types.NBT.createEmptyMap();
+ structures.setMap("starts", newStarts);
+
+ for (final String key : starts.keys()) {
+ final MapType<String> value = starts.getMap(key);
+ if ("INVALID".equals(value.getString("id", "INVALID"))) {
+ continue;
+ }
+
+ final String remapped = getStructureConverted(key, biomeCounts);
+ value.setString("id", remapped);
+ newStarts.setMap(remapped, value);
+ }
+ }
+
+ // This TRULY is a guess, no idea what biomes the referent has.
+ if (references != null) {
+ final MapType<String> newReferences = Types.NBT.createEmptyMap();
+ structures.setMap("References", newReferences);
+ for (final String key : references.keys()) {
+ final long[] value = references.getLongs(key);
+ if (value.length == 0) {
+ continue;
+ }
+
+ newReferences.setLongs(getStructureConverted(key, biomeCounts), value);
+ }
+ }
+
+ return null;
+ }
+ });
+ }
+
+ private static final class BiomeRemap {
+
+ public final Map<String, String> biomeToNewStructure;
+ public final String dfl;
+
+ private BiomeRemap(final Map<String, String> biomeToNewStructure, final String dfl) {
+ this.biomeToNewStructure = biomeToNewStructure;
+ this.dfl = dfl;
+ }
+
+ public static BiomeRemap create(final String newId) {
+ return new BiomeRemap(null, newId);
+ }
+
+ public static BiomeRemap create(final Map<List<String>, String> biomeMap, final String newId) {
+ final Map<String, String> biomeToNewStructure = new HashMap<>();
+
+ for (final Map.Entry<List<String>, String> entry : biomeMap.entrySet()) {
+ final List<String> biomes = entry.getKey();
+ final String newBiomeStructure = entry.getValue();
+
+ for (int i = 0, len = biomes.size(); i < len; ++i) {
+ final String biome = biomes.get(i);
+ if (biomeToNewStructure.putIfAbsent(biome, newBiomeStructure) != null) {
+ throw new IllegalStateException("Duplicate biome remap: " + biome + " -> " + newBiomeStructure + ", but already mapped to " + biomeToNewStructure.get(biome));
+ }
+ }
+ }
+
+ return new BiomeRemap(biomeToNewStructure, newId);
+ }
+ }
+}
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
index 0000000000000000000000000000000000000000..6ab2bf99d72983fc2742a1f6f2f7fa671611526d
@ -17039,7 +17463,7 @@ index 0000000000000000000000000000000000000000..88d9c0fcd88ccfd6d6b46ae050914079
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V704.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V704.java
new file mode 100644
index 0000000000000000000000000000000000000000..5f9cc332c7969f613a912ae66606cbc7352e5ed7
index 0000000000000000000000000000000000000000..216cb6bba5971b17963cd6f60391efccfc36243b
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V704.java
@@ -0,0 +1,335 @@
@ -17055,18 +17479,18 @@ index 0000000000000000000000000000000000000000..5f9cc332c7969f613a912ae66606cbc7
+import ca.spottedleaf.dataconverter.minecraft.walkers.generic.WalkerUtils;
+import ca.spottedleaf.dataconverter.types.ObjectType;
+import ca.spottedleaf.dataconverter.types.MapType;
+import com.mojang.logging.LogUtils;
+import net.minecraft.core.Registry;
+import net.minecraft.world.item.BlockItem;
+import net.minecraft.world.item.Item;
+import net.minecraft.world.level.block.EntityBlock;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.slf4j.Logger;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class V704 {
+
+ private static final Logger LOGGER = LogManager.getLogger();
+ private static final Logger LOGGER = LogUtils.getLogger();
+
+ protected static final int VERSION = MCVersions.V1_10_2 + 192;
+
@ -17074,7 +17498,7 @@ index 0000000000000000000000000000000000000000..5f9cc332c7969f613a912ae66606cbc7
+ @Override
+ public String put(final String key, final String value) {
+ if (this.containsKey(key)) {
+ LOGGER.fatal("Duplicate item id to tile key: " + key);
+ LOGGER.error("Duplicate item id to tile key: " + key);
+ throw new RuntimeException(); // only devs should see the consequence of this... at least start up the damn thing...
+ }
+ return super.put(key, value);
@ -17380,7 +17804,7 @@ index 0000000000000000000000000000000000000000..5f9cc332c7969f613a912ae66606cbc7
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V705.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V705.java
new file mode 100644
index 0000000000000000000000000000000000000000..95e3dd0b76bc9e9ef7388617bdb2dd340b8dfc0d
index 0000000000000000000000000000000000000000..e1d7013e49904dacc5e33d9c0b3f3ddb10e3d07a
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V705.java
@@ -0,0 +1,231 @@
@ -17399,14 +17823,14 @@ index 0000000000000000000000000000000000000000..95e3dd0b76bc9e9ef7388617bdb2dd34
+import ca.spottedleaf.dataconverter.types.ObjectType;
+import ca.spottedleaf.dataconverter.types.ListType;
+import ca.spottedleaf.dataconverter.types.MapType;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import com.mojang.logging.LogUtils;
+import org.slf4j.Logger;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class V705 {
+
+ private static final Logger LOGGER = LogManager.getLogger();
+ private static final Logger LOGGER = LogUtils.getLogger();
+
+ protected static final int VERSION = MCVersions.V1_10_2 + 193;
+
@ -17894,7 +18318,7 @@ index 0000000000000000000000000000000000000000..9e2ef3cea4fd382a75a4d787fe2e2ff5
+}
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V99.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V99.java
new file mode 100644
index 0000000000000000000000000000000000000000..44aff7897f03e0f758e69111b729df6b53ee2ff8
index 0000000000000000000000000000000000000000..d95f8af7bd9bcedbb30be1b59e3dc749551e8cbe
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V99.java
@@ -0,0 +1,348 @@
@ -17914,8 +18338,8 @@ index 0000000000000000000000000000000000000000..44aff7897f03e0f758e69111b729df6b
+import ca.spottedleaf.dataconverter.types.ObjectType;
+import ca.spottedleaf.dataconverter.types.ListType;
+import ca.spottedleaf.dataconverter.types.MapType;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import com.mojang.logging.LogUtils;
+import org.slf4j.Logger;
+import java.util.HashMap;
+import java.util.Map;
+
@ -17923,7 +18347,7 @@ index 0000000000000000000000000000000000000000..44aff7897f03e0f758e69111b729df6b
+
+ // Structure for all data before data upgrading was added to minecraft (pre 15w32a)
+
+ protected static final Logger LOGGER = LogManager.getLogger();
+ private static final Logger LOGGER = LogUtils.getLogger();
+
+ protected static final int VERSION = MCVersions.V15W32A - 1;
+