fix remapping those weird formats
All checks were successful
Publish to snapshot maven / build (push) Successful in 19s

This commit is contained in:
moehreag 2024-07-07 22:52:12 +02:00
parent 25fefae245
commit 69b62e7d0e
6 changed files with 20 additions and 8 deletions

View file

@ -8,7 +8,7 @@ plugins {
}
group = "dev.frogmc"
version = "0.0.1-alpha.7"
version = "0.0.1-alpha.8"
repositories {
mavenCentral()

View file

@ -1,8 +1,10 @@
package dev.frogmc.thyroxine;
import com.electronwill.nightconfig.json.JsonParser;
import org.objectweb.asm.Opcodes;
public final class Constants {
public static final String VERSION_MANIFEST = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json";
public static final JsonParser JSON_PARSER = new JsonParser();
public static final int ASM_VERSION = Opcodes.ASM9;
}

View file

@ -21,7 +21,6 @@ import dev.frogmc.thyroxine.provider.ParchmentProvider;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.ClassRemapper;
public class Thyroxine {
@ -166,7 +165,7 @@ public class Thyroxine {
byte[] bytes = Files.readAllBytes(path);
ClassReader reader = new ClassReader(bytes);
List<String> superTypes = new ArrayList<>();
reader.accept(new ClassVisitor(Opcodes.ASM9) {
reader.accept(new ClassVisitor(Constants.ASM_VERSION) {
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
superTypes.add(superName);

View file

@ -3,11 +3,11 @@ package dev.frogmc.thyroxine.api;
import java.util.Collections;
import java.util.Map;
import dev.frogmc.thyroxine.Constants;
import dev.frogmc.thyroxine.api.data.MappingData;
import dev.frogmc.thyroxine.api.data.Member;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.ClassRemapper;
import org.objectweb.asm.commons.Remapper;
@ -15,7 +15,7 @@ public class ParameterClassRemapper extends ClassRemapper {
private final MappingData data;
public ParameterClassRemapper(ClassVisitor classVisitor, Remapper remapper, MappingData data) {
super(Opcodes.ASM9, classVisitor, remapper);
super(Constants.ASM_VERSION, classVisitor, remapper);
this.data = data;
}

View file

@ -1,10 +1,13 @@
package dev.frogmc.thyroxine.api;
import java.util.*;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import dev.frogmc.thyroxine.Constants;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.MethodRemapper;
import org.objectweb.asm.commons.Remapper;
@ -14,7 +17,7 @@ public class ParameterMethodRemapper extends MethodRemapper {
private final Set<String> usedLocalNames = new HashSet<>();
public ParameterMethodRemapper(MethodVisitor methodVisitor, Remapper remapper, Map<Integer, String> parameters) {
super(Opcodes.ASM9, methodVisitor, remapper);
super(Constants.ASM_VERSION, methodVisitor, remapper);
this.parameters = parameters;
}

View file

@ -163,6 +163,14 @@ public record MappingBundle(List<MappingData> data, List<DocumentationData> docu
String w = res;
res = d.classes().get(res);
if (res == null) {
int dollar = w.indexOf("$");
if (dollar != -1) {
String prefix = d.classes().get(w.substring(0, dollar));
if (prefix != null) {
res = prefix + w.substring(dollar);
break;
}
}
if (!allowIncomplete) {
/*
* The mapping set is incomplete at this point.