Skip to content

Commit

Permalink
Fix helper class path
Browse files Browse the repository at this point in the history
  • Loading branch information
kappa-maintainer committed Mar 15, 2024
1 parent df0bc6e commit 1d3c5e4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public byte[] transform(byte[] bytes) {
{
if (methodInsnNode.name.equals("getPath") && methodInsnNode.owner.equals("java/net/URI"))
{
instructions.insert(methodInsnNode, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/cleanroommc/helper/HookHelper", "byGetResource", "()Ljava/lang/String;", false));
instructions.insert(methodInsnNode, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/cleanroommc/fugue/helper/HookHelper", "byGetResource", "()Ljava/lang/String;", false));
instructions.insert(methodInsnNode, new InsnNode(Opcodes.POP));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public byte[] transform(byte[] bytes) {
InsnList toInsert = new InsnList();
toInsert.add(new VarInsnNode(Opcodes.ALOAD, 10));
toInsert.add(new VarInsnNode(Opcodes.ILOAD, 6));
toInsert.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/cleanroommc/helper/HookHelper", "isInterface", "(I)Z"));
toInsert.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/cleanroommc/fugue/helper/HookHelper", "isInterface", "(I)Z"));
toInsert.add(new FieldInsnNode(Opcodes.PUTFIELD, "org/objectweb/asm/tree/MethodInsnNode", "itf", "Z"));
instructions.insert(fieldInsnNode, toInsert);
modified = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public byte[] transform(byte[] bytes) {
classNode.methods.forEach(m -> m.instructions.forEach(n -> {
if (n.getOpcode() == Opcodes.INVOKEVIRTUAL && n instanceof MethodInsnNode methodInsnNode) {
if (methodInsnNode.owner.equals("java/net/URL") && methodInsnNode.name.equals("openStream")) {
m.instructions.insert(methodInsnNode, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/cleanroommc/helper/HookHelper", "open", "(Ljava/net/URL;)Ljava/io/InputStream;", false));
m.instructions.insert(methodInsnNode, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/cleanroommc/fugue/helper/HookHelper", "open", "(Ljava/net/URL;)Ljava/io/InputStream;", false));
m.instructions.remove(methodInsnNode);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public byte[] transform(byte[] bytes) {
} else if (methodInsnNode.getOpcode() == Opcodes.INVOKEVIRTUAL &&
methodInsnNode.owner.equals("java/lang/Class") && (methodInsnNode.name.equals("getDeclaredField") || methodInsnNode.name.equals("getField"))) {

methodNode.instructions.insert(abstractInsnNode, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/cleanroommc/helper/HookHelper", "getField", "(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/reflect/Field;"));
methodNode.instructions.insert(abstractInsnNode, new MethodInsnNode(Opcodes.INVOKESTATIC, "com/cleanroommc/fugue/helper/HookHelper", "getField", "(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/reflect/Field;"));
methodNode.instructions.remove(abstractInsnNode);
}
}
Expand Down

0 comments on commit 1d3c5e4

Please sign in to comment.