Start implementing the ASM helpers

This commit is contained in:
FalsePattern committed 2022-07-25 20:21:43 +02:00
1 parent 5f740d9097
commit f12b7409bc
7 files changed
+204

No files matched your search

@@ -74,6 +74,17 @@ public class MappingManager {
}
}
public static boolean containsClass(NameType nameType, MappingType mappingType, String className) {
switch (nameType) {
case Internal:
return internalLookup.containsKey(mappingType, className);
case Regular:
return regularLookup.containsKey(mappingType, className);
default:
throw new IllegalArgumentException("Invalid enum value " + nameType);
}
}
public static UniversalField getField(FieldInsnNode instruction) throws ClassNotFoundException,
NoSuchFieldException {
if (!CoreLoadingPlugin.isObfuscated()) {
@@ -24,6 +24,19 @@ public class Lookup<T> {
return values.contains(value);
}
public boolean containsKey(MappingType mappingType, String key) {
switch (mappingType) {
case Notch:
return notch.containsKey(key);
case SRG:
return srg.containsKey(key);
case MCP:
return mcp.containsKey(key);
default:
throw new IllegalArgumentException("Invalid enum value " + mappingType);
}
}
public void unwrap(@NonNull MappedString mappedString, @NonNull T value) {
if (contains(value)) {
//Collision avoidance.