Posted April 26, 201411 yr I solved it by adding @SortingOrder(1001) above my FMLLoadingPlugin (thank you diesieben07) So I've got a strange problem with my current coremod, which I try to update to 1.7.2. I use several ASM transformers and they seem to run fine and do the correct changes (I wrote the classes as files and opened them with JD-GUI, every patch is correctly applied) However when I pack / build my coremod, put it into the mods folder and try to start Minecraft, I get a NullPointerException. The byte array supplied by the transform method is null (I put a println with the byte array and it printed null) Here some details: Forge version used: 10.12.1.1061 Crash report: https://gist.github.com/SanAndreasP/a18ef19f6f5efce65464 whole log file: (seems to be cut off and doesn't show the error, idk why) https://gist.github.com/SanAndreasP/4a6d737d043276f4b50e offending class: https://github.com/SanAndreasP/SAPManagerPack/blob/master/java/de/sanandrew/core/manpack/transformer/TransformPlayerDismountCtrl.java#L23 whole source: https://github.com/SanAndreasP/SAPManagerPack/tree/master/java/de/sanandrew/core/manpack Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
April 27, 201411 yr Author If I remember correctly your transformer will be called with a null byte array if a class couldn't be found in some cases. Try and check for null and if it is null, just return null yourself. Then it will not crash with your ClassTransformer and you will get a proper stack trace as to where the CNFE is coming from. Just an idea. Yes, seems like my ChannelHandler caused it when I initialized it statically like static final Inst var = new Inst(params); Now the only problem persisting is that it seems that I can't use COMPUTE_FRAMES flag for the ClassWriter when I convert the transformed class back into a byte array... And again, only in a non-dev environment, in eclipse, everything works as expected. It just gives me an InvocationTargetException caused by a ClassNotFoundException [12:41:19 INFO]: Client> java.lang.reflect.InvocationTargetException [12:41:19 INFO]: Client> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] [12:41:19 INFO]: Client> at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] [12:41:19 INFO]: Client> Caused by: java.lang.NoClassDefFoundError: net/minecraft/entity/projectile/EntitySnowball [12:41:19 INFO]: Client> at net.minecraft.item.Item.func_150900_l(Item.java:171) ~[abn.class:?] [12:41:19 INFO]: Client> at net.minecraft.init.Bootstrap.func_151354_b(SourceFile:358) ~[kb.class:?] [12:41:19 INFO]: Client> at net.minecraft.client.Minecraft.<init>(Minecraft.java:266) ~[azd.class:?] [12:41:19 INFO]: Client> at net.minecraft.client.main.Main.main(SourceFile:84) ~[Main.class:?] [12:41:19 INFO]: Client> ... 6 more [12:41:19 INFO]: Client> Caused by: java.lang.ClassNotFoundException: net.minecraft.entity.projectile.EntitySnowball [12:41:19 INFO]: Client> at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) ~[launchwrapper-1.9.jar:?] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at net.minecraft.item.Item.func_150900_l(Item.java:171) ~[abn.class:?] [12:41:19 INFO]: Client> at net.minecraft.init.Bootstrap.func_151354_b(SourceFile:358) ~[kb.class:?] [12:41:19 INFO]: Client> at net.minecraft.client.Minecraft.<init>(Minecraft.java:266) ~[azd.class:?] [12:41:19 INFO]: Client> at net.minecraft.client.main.Main.main(SourceFile:84) ~[Main.class:?] [12:41:19 INFO]: Client> ... 6 more [12:41:19 INFO]: Client> Caused by: java.lang.NoClassDefFoundError: net/minecraft/entity/projectile/EntityThrowable [12:41:19 INFO]: Client> at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:180) ~[launchwrapper-1.9.jar:?] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at net.minecraft.item.Item.func_150900_l(Item.java:171) ~[abn.class:?] [12:41:19 INFO]: Client> at net.minecraft.init.Bootstrap.func_151354_b(SourceFile:358) ~[kb.class:?] [12:41:19 INFO]: Client> at net.minecraft.client.Minecraft.<init>(Minecraft.java:266) ~[azd.class:?] [12:41:19 INFO]: Client> at net.minecraft.client.main.Main.main(SourceFile:84) ~[Main.class:?] [12:41:19 INFO]: Client> ... 6 more [12:41:19 INFO]: Client> Caused by: java.lang.ClassNotFoundException: net.minecraft.entity.projectile.EntityThrowable [12:41:19 INFO]: Client> at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188) ~[launchwrapper-1.9.jar:?] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:180) ~[launchwrapper-1.9.jar:?] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at net.minecraft.item.Item.func_150900_l(Item.java:171) ~[abn.class:?] [12:41:19 INFO]: Client> at net.minecraft.init.Bootstrap.func_151354_b(SourceFile:358) ~[kb.class:?] [12:41:19 INFO]: Client> at net.minecraft.client.Minecraft.<init>(Minecraft.java:266) ~[azd.class:?] [12:41:19 INFO]: Client> at net.minecraft.client.main.Main.main(SourceFile:84) ~[Main.class:?] [12:41:19 INFO]: Client> ... 6 more [12:41:19 INFO]: Client> Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: ayi [12:41:19 INFO]: Client> at org.objectweb.asm.ClassWriter.getCommonSuperClass(Unknown Source) ~[asm-all-4.1.jar:4.1] [12:41:19 INFO]: Client> at org.objectweb.asm.ClassWriter.a(Unknown Source) ~[asm-all-4.1.jar:4.1] [12:41:19 INFO]: Client> at org.objectweb.asm.Frame.a(Unknown Source) ~[asm-all-4.1.jar:4.1] [12:41:19 INFO]: Client> at org.objectweb.asm.Frame.a(Unknown Source) ~[asm-all-4.1.jar:4.1] [12:41:19 INFO]: Client> at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source) ~[asm-all-4.1.jar:4.1] [12:41:19 INFO]: Client> at org.objectweb.asm.tree.MethodNode.accept(Unknown Source) ~[asm-all-4.1.jar:4.1] [12:41:19 INFO]: Client> at org.objectweb.asm.tree.MethodNode.accept(Unknown Source) ~[asm-all-4.1.jar:4.1] [12:41:19 INFO]: Client> at org.objectweb.asm.tree.ClassNode.accept(Unknown Source) ~[asm-all-4.1.jar:4.1] [12:41:19 INFO]: Client> at de.sanandrew.core.manpack.transformer.ASMHelper.createBytes(ASMHelper.java:124) ~[sAPManPack-1.7.2-2.0.0.jar:?] [12:41:19 INFO]: Client> at de.sanandrew.core.manpack.transformer.TransformEntityThrowable.transformLqThrowable(TransformEntityThrowable.java:108) ~[sAPManPack-1.7.2-2.0.0.jar:?] [12:41:19 INFO]: Client> at de.sanandrew.core.manpack.transformer.TransformEntityThrowable.transform(TransformEntityThrowable.java:37) ~[sAPManPack-1.7.2-2.0.0.jar:?] [12:41:19 INFO]: Client> at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:276) ~[launchwrapper-1.9.jar:?] [12:41:19 INFO]: Client> at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:174) ~[launchwrapper-1.9.jar:?] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:180) ~[launchwrapper-1.9.jar:?] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_25] [12:41:19 INFO]: Client> at net.minecraft.item.Item.func_150900_l(Item.java:171) ~[abn.class:?] [12:41:19 INFO]: Client> at net.minecraft.init.Bootstrap.func_151354_b(SourceFile:358) ~[kb.class:?] [12:41:19 INFO]: Client> at net.minecraft.client.Minecraft.<init>(Minecraft.java:266) ~[azd.class:?] [12:41:19 INFO]: Client> at net.minecraft.client.main.Main.main(SourceFile:84) ~[Main.class:?] [12:41:19 INFO]: Client> ... 6 more Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
April 27, 201411 yr Author Hrm. COMPUTE_FRAMES is always a dangerous spot, because it triggers class-loading of other classes. I see you are using "notched" class-names in your transformation. Don't do that, FML transforms all the classes to have their MCP name at runtime, so if you use those you should be fine. Maybe that is the problem. I'm only using notched class names when I search for a needle in a haystack (since the ClassNode has it's instructions only in notched code for whatever reason) Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
April 27, 201411 yr Author Oh. If you do @SortingIndex(1001) (or bigger) on your IFMLLoadingPlugin your transformers run after the deobfuscation transformer. In all honesty I am quite unsure as to where your error is originating from http://ih0.redbubble.net/image.15030945.3699/fc,550x550,white.u1.jpg[/img] The sorting index worked like a charm and instantly killed all my problems. Also I don't have to worry about the notched method/field/class naming crap anymore. I can't thank you enough \o/ Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.