From d2de90ee256ffe92a33ef9f55d03be45b9693f5e Mon Sep 17 00:00:00 2001 From: tr7zw Date: Tue, 3 Dec 2024 23:28:21 +0100 Subject: [PATCH] Add 1.21.4 support --- .../de/tr7zw/changeme/nbtapi/utils/DataFixerUtil.java | 5 ++++- .../tr7zw/changeme/nbtapi/utils/MinecraftVersion.java | 3 ++- .../nbtapi/utils/nmsmappings/MojangToMapping.java | 11 +++++++++++ .../java/dev/tr7zw/mappingsparser/MappingsParser.java | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/DataFixerUtil.java b/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/DataFixerUtil.java index 331036999..b1cc812f8 100644 --- a/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/DataFixerUtil.java +++ b/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/DataFixerUtil.java @@ -31,6 +31,7 @@ public class DataFixerUtil { public static final int VERSION1_20_5 = 3837; public static final int VERSION1_21 = 3953; public static final int VERSION1_21_2 = 4080; + public static final int VERSION1_21_3 = 4189; @SuppressWarnings("unchecked") public static Object fixUpRawItemData(Object nbt, int fromVersion, int toVersion) @@ -63,7 +64,9 @@ public static ReadWriteNBT fixUpItemData(ReadWriteNBT nbt, int fromVersion, int * @return */ public static int getCurrentVersion() { - if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_21_R2)) { + if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_21_R3)) { + return VERSION1_21_3; + } else if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_21_R2)) { return VERSION1_21_2; } else if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_21_R1)) { return VERSION1_21; diff --git a/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/MinecraftVersion.java b/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/MinecraftVersion.java index b49afda5c..8f546ef1a 100644 --- a/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/MinecraftVersion.java +++ b/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/MinecraftVersion.java @@ -24,7 +24,7 @@ public enum MinecraftVersion { MC1_13_R1(1131), MC1_13_R2(1132), MC1_14_R1(1141), MC1_15_R1(1151), MC1_16_R1(1161), MC1_16_R2(1162), MC1_16_R3(1163), MC1_17_R1(1171), MC1_18_R1(1181, true), MC1_18_R2(1182, true), MC1_19_R1(1191, true), MC1_19_R2(1192, true), MC1_19_R3(1193, true), MC1_20_R1(1201, true), MC1_20_R2(1202, true), MC1_20_R3(1203, true), - MC1_20_R4(1204, true), MC1_21_R1(1211, true), MC1_21_R2(1212, true); + MC1_20_R4(1204, true), MC1_21_R1(1211, true), MC1_21_R2(1212, true), MC1_21_R3(1213, true); private static MinecraftVersion version; private static Boolean hasGsonSupport; @@ -59,6 +59,7 @@ public enum MinecraftVersion { this.put("1.21.1", MC1_21_R1); this.put("1.21.2", MC1_21_R2); this.put("1.21.3", MC1_21_R2); + this.put("1.21.4", MC1_21_R3); } }; diff --git a/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/nmsmappings/MojangToMapping.java b/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/nmsmappings/MojangToMapping.java index 74929a28c..6cf03b81a 100644 --- a/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/nmsmappings/MojangToMapping.java +++ b/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/utils/nmsmappings/MojangToMapping.java @@ -197,10 +197,21 @@ public class MojangToMapping { }; + @SuppressWarnings("serial") + private static Map MC1_21R3 = new HashMap() { + + { + putAll(MC1_21R2); + put("net.minecraft.world.item.component.CustomData#copyTag()", "d"); + } + + }; public static Map getMapping() { switch (MinecraftVersion.getVersion()) { + case MC1_21_R3: + return MC1_21R3; case MC1_21_R2: return MC1_21R2; case MC1_21_R1: diff --git a/mappings-parser/src/main/java/dev/tr7zw/mappingsparser/MappingsParser.java b/mappings-parser/src/main/java/dev/tr7zw/mappingsparser/MappingsParser.java index 31f59d8e6..bc92c2bd5 100644 --- a/mappings-parser/src/main/java/dev/tr7zw/mappingsparser/MappingsParser.java +++ b/mappings-parser/src/main/java/dev/tr7zw/mappingsparser/MappingsParser.java @@ -24,7 +24,7 @@ public class MappingsParser { public static StringBuilder builder = new StringBuilder(); public static void main(String[] args) throws IOException { - File input = new File("minecraft_server.1.21.2.txt"); + File input = new File("minecraft_server.1.21.4.txt"); List lines = Files.readAllLines(input.toPath()); Map classes = new HashMap<>();