Posted May 24, 20169 yr Hello, I am trying to harvest annotation data from mods to do a similar thing to what @Mod.Instance and @SidedProxy do. I am doing this by subscribing to the FMLConstructionEvent, and using the ASM harvested data to inject the values. This has been working great in the development environment, but when in a release build, it crashes with a NPE. ModContainer#getMod() returns null for other mods, causing the crash. I'm not sure if this is caused by the fact that they are ordered differently in the development environment or if it's something else. You can view the source here: https://github.com/iLexiconn/LLibrary/blob/1.9.4/src/main/java/net/ilexiconn/llibrary/LLibrary.java It crashes here: https://github.com/iLexiconn/LLibrary/blob/1.9.4/src/main/java/net/ilexiconn/llibrary/server/config/ConfigHandler.java#L54 Thanks in advance.
May 24, 20169 yr Author Hello, I am trying to harvest annotation data from mods to do a similar thing to what @Mod.Instance and @SidedProxy do. I am doing this by subscribing to the FMLConstructionEvent, and using the ASM harvested data to inject the values. This has been working great in the development environment, but when in a release build, it crashes with a NPE. ModContainer#getMod() returns null for other mods, causing the crash. I'm not sure if this is caused by the fact that they are ordered differently in the development environment or if it's something else. You can view the source here: https://github.com/iLexiconn/LLibrary/blob/1.9.4/src/main/java/net/ilexiconn/llibrary/LLibrary.java It crashes here: https://github.com/iLexiconn/LLibrary/blob/1.9.4/src/main/java/net/ilexiconn/llibrary/server/config/ConfigHandler.java#L54 Thanks in advance.
May 24, 20169 yr Author Don't use the @Mod annotation. The ModContainer already gives you the ModID. That way your annotation can be in any class of the mod and it will also work for non-FML mods (e.g. coremods). Thanks for your help! mod.getMod() is still needed for field.set(), but it can be forced to be static like all other annotations.
May 24, 20169 yr Author Don't use the @Mod annotation. The ModContainer already gives you the ModID. That way your annotation can be in any class of the mod and it will also work for non-FML mods (e.g. coremods). Thanks for your help! mod.getMod() is still needed for field.set(), but it can be forced to be static like all other annotations.
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.