Skip to content
This repository was archived by the owner on Jan 3, 2020. It is now read-only.

Commit a8b0c99

Browse files
committed
bugfix for obfuscated env
1 parent 3e7be8e commit a8b0c99

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/main/java/org/devinprogress/uniskinmod/ASMHelper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ public static AbstractInsnNode getNthInsnNode(MethodNode mn,int opcode,int N){
7979
return n;
8080
}
8181

82+
public static AbstractInsnNode getLabel(AbstractInsnNode n){
83+
if(!(n instanceof JumpInsnNode)){
84+
throw new RuntimeException("Not a valid JumpInsnNode");
85+
}else{
86+
return ((JumpInsnNode)n).label;
87+
}
88+
}
8289
public static void InsertInvokeStaticBefore(MethodNode mn,AbstractInsnNode n,String targetClass,String targetMethod,String desc){
8390
mn.instructions.insertBefore(n, new MethodInsnNode(Opcodes.INVOKESTATIC,
8491
targetClass.replace('.', '/'), targetMethod, desc,false));

src/main/java/org/devinprogress/uniskinmod/CoreTransformer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ public static void injectCode(MethodNode mn){
4949
SkinCore.log("ASMTransformer Invoked");
5050
AbstractInsnNode n=ASMHelper.getNthInsnNode(mn,Opcodes.GETFIELD,2);
5151
FieldInsnNode loadGameProfileToStack=(FieldInsnNode) ((FieldInsnNode)n).clone(null);
52-
n=ASMHelper.getNthInsnNode(mn, Opcodes.INVOKEVIRTUAL,8);
53-
n=n.getNext().getNext();
52+
n=ASMHelper.getNthInsnNode(mn, Opcodes.IFEQ,1);
53+
n=ASMHelper.getLabel(n).getNext();
54+
5455
mn.instructions.insertBefore(n, new VarInsnNode(Opcodes.ALOAD,1));
5556
mn.instructions.insertBefore(n, new VarInsnNode(Opcodes.ALOAD,0));
5657
mn.instructions.insertBefore(n, loadGameProfileToStack);

0 commit comments

Comments
 (0)