我试图改变一个类中的方法,这是有效的,但我想调用我的代码,然后用我的参数调用原始方法,这是不行的,每当我尝试这样做的时候我得到ArrayIndexOutOfBoundsException。我不知道是什么导致了它,我无法找到其他任何人。我不确定下面的代码是否正确:
MethodNode copy = new MethodNode();
copy.desc = method.desc;
copy.attrs = method.attrs;
copy.access = method.access;
copy.exceptions = method.exceptions;
copy.annotationDefault = method.annotationDefault;
copy.invisibleAnnotations = method.invisibleAnnotations;
copy.instructions.add(method.instructions);
copy.signature = method.signature;
copy.name = method.name + "_orig";
originalMethod = copy;
classNode.methods.add(copy);
完全例外:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 34
at org.objectweb.asm.ClassReader.readLabel(ClassReader.java:2174)
at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1059)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1017)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:693)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
at net.minecraftforge.fml.common.asm.transformers.DeobfuscationTransformer.transform(DeobfuscationTransformer.java:44)
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)
... 25 more