Remap package name (#120)
This commit is contained in:
parent
093932b3ed
commit
18ef0518d0
@ -7,6 +7,7 @@ public class ArclightVersion {
|
|||||||
public static final ArclightVersion v1_14 = new ArclightVersion("1.14.4", 1140, "v1_14_R1");
|
public static final ArclightVersion v1_14 = new ArclightVersion("1.14.4", 1140, "v1_14_R1");
|
||||||
public static final ArclightVersion v1_15 = new ArclightVersion("1.15.2", 1152, "v1_15_R1");
|
public static final ArclightVersion v1_15 = new ArclightVersion("1.15.2", 1152, "v1_15_R1");
|
||||||
public static final ArclightVersion v1_16 = new ArclightVersion("1.16.3", 1163, "v1_16_R2");
|
public static final ArclightVersion v1_16 = new ArclightVersion("1.16.3", 1163, "v1_16_R2");
|
||||||
|
public static final ArclightVersion v1_16_4 = new ArclightVersion("1.16.4", 1164, "v1_16_R3");
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int num;
|
private final int num;
|
||||||
|
|||||||
@ -72,6 +72,10 @@ public class ArclightRedirectAdapter implements PluginTransformer {
|
|||||||
method(Opcodes.INVOKESTATIC, Class.class, "forName", String.class, boolean.class, ClassLoader.class),
|
method(Opcodes.INVOKESTATIC, Class.class, "forName", String.class, boolean.class, ClassLoader.class),
|
||||||
method(Opcodes.INVOKESTATIC, ArclightReflectionHandler.class, "redirectForName", String.class, boolean.class, ClassLoader.class)
|
method(Opcodes.INVOKESTATIC, ArclightReflectionHandler.class, "redirectForName", String.class, boolean.class, ClassLoader.class)
|
||||||
)
|
)
|
||||||
|
.put(
|
||||||
|
method(Opcodes.INVOKEVIRTUAL, Package.class, "getName"),
|
||||||
|
method(Opcodes.INVOKESTATIC, ArclightReflectionHandler.class, "redirectPackageGetName", Package.class)
|
||||||
|
)
|
||||||
.put(
|
.put(
|
||||||
method(Opcodes.INVOKESTATIC, MethodType.class, "fromMethodDescriptorString", String.class, ClassLoader.class),
|
method(Opcodes.INVOKESTATIC, MethodType.class, "fromMethodDescriptorString", String.class, ClassLoader.class),
|
||||||
method(Opcodes.INVOKESTATIC, ArclightReflectionHandler.class, "redirectFromDescStr", String.class, ClassLoader.class)
|
method(Opcodes.INVOKESTATIC, ArclightReflectionHandler.class, "redirectFromDescStr", String.class, ClassLoader.class)
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package io.izzel.arclight.common.mod.util.remapper.generated;
|
package io.izzel.arclight.common.mod.util.remapper.generated;
|
||||||
|
|
||||||
|
import io.izzel.arclight.api.ArclightVersion;
|
||||||
import io.izzel.arclight.api.Unsafe;
|
import io.izzel.arclight.api.Unsafe;
|
||||||
import io.izzel.arclight.common.mod.util.remapper.ClassLoaderAdapter;
|
import io.izzel.arclight.common.mod.util.remapper.ClassLoaderAdapter;
|
||||||
import io.izzel.arclight.common.mod.util.remapper.ClassLoaderRemapper;
|
import io.izzel.arclight.common.mod.util.remapper.ClassLoaderRemapper;
|
||||||
@ -147,6 +148,16 @@ public class ArclightReflectionHandler extends ClassLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// srg -> bukkit
|
||||||
|
public static String redirectPackageGetName(Package pkg) {
|
||||||
|
String name = pkg.getName();
|
||||||
|
if (name.startsWith(PREFIX)) {
|
||||||
|
return PREFIX + "server." + ArclightVersion.current().packageName();
|
||||||
|
} else {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bukkit -> srg
|
// bukkit -> srg
|
||||||
public static MethodType redirectFromDescStr(String desc, ClassLoader classLoader) {
|
public static MethodType redirectFromDescStr(String desc, ClassLoader classLoader) {
|
||||||
String methodDesc = remapper.mapMethodDesc(desc);
|
String methodDesc = remapper.mapMethodDesc(desc);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ public class Main_1_16 extends ArclightMain {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void afterSetup() throws Throwable {
|
protected void afterSetup() throws Throwable {
|
||||||
ArclightVersion.setVersion(ArclightVersion.v1_16);
|
ArclightVersion.setVersion(ArclightVersion.v1_16_4);
|
||||||
ForgeInstaller.install();
|
ForgeInstaller.install();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user