Skip to content

Commit

Permalink
Add back vanilla transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
kappa-maintainer committed Dec 18, 2024
1 parent 0a47fd1 commit a072262
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ public class LWJGLTransformer implements IClassTransformer {
@Override
public byte[] transform(String s, String s1, byte[] bytes) {
if (s1.startsWith("net.minecraft")) {
return bytes;
ClassReader reader = new ClassReader(bytes);
ClassWriter writer = new ClassWriter(0);
ClassVisitor visitor = new ClassRemapper(writer, INSTANCE);
reader.accept(visitor, 0);
return writer.toByteArray();
}
if (!s1.startsWith("org.lwjgl.")) {
return bytes;
}
String lwjglxName = s.replace("org.lwjgl", "org.lwjglx");
String lwjglxName = s.replace("org.lwjgl.", "org.lwjglx.");
byte[] lwjglxBytes;
try {
lwjglxBytes = Launch.classLoader.testGetClassBytes(lwjglxName);
Expand Down Expand Up @@ -73,8 +77,8 @@ public String map(String typeName) {
if (typeName == null) {
return null;
}
if (typeName.startsWith("org/lwjglx")) {
return "org/lwjgl" + typeName.substring(10);
if (typeName.startsWith("org/lwjglx/")) {
return "org/lwjgl/" + typeName.substring(10);
}

return typeName;
Expand Down

0 comments on commit a072262

Please sign in to comment.