Skip to content

Commit

Permalink
Update to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Jun 13, 2024
1 parent 633433d commit cf30cf9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public enum MinecraftVersion {
MC1_7_R4(174), MC1_8_R3(183), MC1_9_R1(191), MC1_9_R2(192), MC1_10_R1(1101), MC1_11_R1(1111), MC1_12_R1(1121),
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_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);

private static MinecraftVersion version;
private static Boolean hasGsonSupport;
Expand Down Expand Up @@ -54,6 +55,7 @@ public enum MinecraftVersion {
this.put("1.20.4", MC1_20_R3);
this.put("1.20.5", MC1_20_R4);
this.put("1.20.6", MC1_20_R4);
this.put("1.21.0", MC1_21_R1);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/**
* Temporary solution to hold Mojang to unmapped Spigot mappings.
* Note years later: nothing is more permanent than a temporary solution.
*
* @author tr7zw
*
Expand Down Expand Up @@ -171,10 +172,23 @@ public class MojangToMapping {
}

};

@SuppressWarnings("serial")
private static Map<String, String> MC1_21R1 = new HashMap<String, String>() {

{
putAll(MC1_20R4);

put("net.minecraft.world.entity.Entity#getEncodeId()", "bD");
}

};


public static Map<String, String> getMapping() {
switch (MinecraftVersion.getVersion()) {
case MC1_21_R1:
return MC1_21R1;
case MC1_20_R4:
return MC1_20R4;
case MC1_20_R3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Map.Entry;

import de.tr7zw.changeme.nbtapi.utils.nmsmappings.ClassWrapper;
import de.tr7zw.changeme.nbtapi.utils.nmsmappings.MojangToMapping;
import de.tr7zw.changeme.nbtapi.utils.nmsmappings.ReflectionMethod;

/**
Expand All @@ -24,7 +25,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.20.5.txt");
File input = new File("minecraft_server.1.21.txt");
List<String> lines = Files.readAllLines(input.toPath());

Map<String, ClassWrapper> classes = new HashMap<>();
Expand Down Expand Up @@ -84,6 +85,8 @@ public static void proccessMapping(ClassWrapper nmsWrapper, Map<ReflectionMethod
System.out.println(
"Missing mapping in class " + nmsWrapper.getMojangName() + " method " + entry.getKey().name());
} else {
if(!entry.getValue().equals(MojangToMapping.getMapping().get(nmsWrapper.getMojangName() + "#"
+ entry.getKey().getSelectedVersionInfo().name)))
builder.append("put(\"" + nmsWrapper.getMojangName() + "#"
+ entry.getKey().getSelectedVersionInfo().name + "\", \"" + entry.getValue() + "\");\n");
}
Expand Down

0 comments on commit cf30cf9

Please sign in to comment.