Skip to content

Commit

Permalink
Fix LWJGL transformer for real
Browse files Browse the repository at this point in the history
  • Loading branch information
kappa-maintainer committed Dec 18, 2024
1 parent ec71313 commit 119c4e9
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraft.launchwrapper.Launch;
import net.minecraftforge.fml.common.FMLLog;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
Expand Down Expand Up @@ -53,15 +54,15 @@ public byte[] transform(String s, String s1, byte[] bytes) {
lwjglxReader = new ClassReader(lwjglxBytes);
ClassNode lwjglxNode = new ClassNode();
lwjglxReader.accept(lwjglxNode, 0);
Set<String> methods = lwjglNode.methods.stream().map(m -> m.desc).collect(Collectors.toSet());
Set<String> methods = lwjglNode.methods.stream().map(m -> m.name + m.desc).collect(Collectors.toSet());
lwjglxNode.methods.forEach(m -> {
if (!methods.contains(m.desc)) {
if (!methods.contains(m.name + m.desc)) {
lwjglNode.methods.add(m);
}
});
Set<String> fields = lwjglNode.fields.stream().map(f -> f.desc).collect(Collectors.toSet());
Set<String> fields = lwjglNode.fields.stream().map(f -> f.name + f.desc).collect(Collectors.toSet());
lwjglxNode.fields.forEach(f -> {
if (!fields.contains(f.desc)) {
if (!fields.contains(f.name + f.desc)) {
lwjglNode.fields.add(f);
}
});
Expand Down

0 comments on commit 119c4e9

Please sign in to comment.