From 7607e6be9b7d37e9dd927476141e468ac222e497 Mon Sep 17 00:00:00 2001 From: thatsIch Date: Tue, 30 Sep 2014 15:53:45 +0200 Subject: [PATCH] Replaced MethodIsnNode of ASM with newer constructor to resolve deprecation --- src/main/java/appeng/transformer/asm/ASMTweaker.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/appeng/transformer/asm/ASMTweaker.java b/src/main/java/appeng/transformer/asm/ASMTweaker.java index 58d83349..bcf6c0a0 100644 --- a/src/main/java/appeng/transformer/asm/ASMTweaker.java +++ b/src/main/java/appeng/transformer/asm/ASMTweaker.java @@ -54,7 +54,7 @@ public class ASMTweaker implements IClassTransformer public byte[] transform(String name, String transformedName, byte[] basicClass) { if ( basicClass == null ) - return basicClass; + return null; try { @@ -79,9 +79,7 @@ public class ASMTweaker implements IClassTransformer MethodNode newNode = new MethodNode( Opcodes.ACC_PUBLIC, "func_146977_a_original", mn.desc, mn.signature, new String[0] ); newNode.instructions.add( new VarInsnNode( Opcodes.ALOAD, 0 ) ); newNode.instructions.add( new VarInsnNode( Opcodes.ALOAD, 1 ) ); - //newNode.instructions.add( new MethodInsnNode( Opcodes.INVOKESPECIAL, classNode.name, mn.name, mn.desc, false ) ); - // TODO: Update for newer forge - newNode.instructions.add( new MethodInsnNode( Opcodes.INVOKESPECIAL, classNode.name, mn.name, mn.desc ) ); + newNode.instructions.add( new MethodInsnNode( Opcodes.INVOKESPECIAL, classNode.name, mn.name, mn.desc, false ) ); newNode.instructions.add( new InsnNode( Opcodes.RETURN ) ); log( newNode.name + newNode.desc + " - New Method" ); classNode.methods.add( newNode ); @@ -103,9 +101,7 @@ public class ASMTweaker implements IClassTransformer if ( n.name.equals( "func_146977_a" ) || (n.name.equals( "a" ) && n.desc.equals( "(Lzk;)V" )) ) { log( n.name + n.desc + " - Invoke Virtual" ); - //mn.instructions.insertBefore( n, new MethodInsnNode( Opcodes.INVOKEVIRTUAL, n.owner, n.name, n.desc, false ) ); - // TODO: Update for newer forge - mn.instructions.insertBefore( n, new MethodInsnNode( Opcodes.INVOKEVIRTUAL, n.owner, n.name, n.desc ) ); + mn.instructions.insertBefore( n, new MethodInsnNode( Opcodes.INVOKEVIRTUAL, n.owner, n.name, n.desc, false ) ); mn.instructions.remove( in ); break; } @@ -120,7 +116,7 @@ public class ASMTweaker implements IClassTransformer return writer.toByteArray(); } } - catch (Throwable t) + catch (Throwable ignored) { }