Skip to content

Commit

Permalink
"fix" lwjgltransformer (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
PrototypeTrousers authored Dec 18, 2024
1 parent 9fafd98 commit 0a47fd1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ public class LWJGLTransformer implements IClassTransformer {
@Override
public byte[] transform(String s, String s1, byte[] bytes) {
if (s1.startsWith("net.minecraft")) {
ClassReader reader = new ClassReader(bytes);
ClassWriter writer = new ClassWriter(0);
ClassVisitor visitor = new ClassRemapper(writer, INSTANCE);
reader.accept(visitor, 0);
return writer.toByteArray();
return bytes;
}
if (!s1.startsWith("org.lwjgl")) {
if (!s1.startsWith("org.lwjgl.")) {
return bytes;
}
String lwjglxName = s.replace("org.lwjgl", "org.lwjglx");
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/org/lwjglx/PointerBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.lwjglx;

import org.apache.commons.lang3.reflect.FieldUtils;

import java.lang.reflect.Field;
import java.nio.*;

Expand All @@ -26,11 +28,7 @@ public class PointerBuffer extends org.lwjgl.PointerBuffer {

static {
Class<org.lwjgl.PointerBuffer> pbClass = org.lwjgl.PointerBuffer.class;
try {
containerAccess = pbClass.getDeclaredField("container");
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
}
containerAccess = FieldUtils.getField(pbClass, "container", true);
}

private static ByteBuffer getContainer(org.lwjgl.PointerBuffer buffer) {
Expand Down

0 comments on commit 0a47fd1

Please sign in to comment.