Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

NoClassDefFound only in "normal" minecraft


xilef11
 Share

Recommended Posts

Hello

 

I have two mods I have been developing in parallel: a "core" Library and an "addon". During development, I had both mods in the same workspace and added the core library project to the build path of the addon project and everything worked perfectly.

 

In order to build the addon project via gradle, I had to make a deobf jar of the core library and put it in ./libs (I thought a deobf version was no longer necessary because FG deobfuscated at runtime, but it wouldn't compile otherwise). Once again, everything builds and runs perfectly under gradle (gradlew runClient)

 

However, when I try to run both mods (the normal, obfuscated versions) in a normal Minecraft instance, I get the following crash: http://pastebin.com/cgmkhTJw The error seems to be the addon complaining about a "missing" class in the core library, but that class does exist in the jar that is in the mods folder.

 

I have tried rebuilding both mods a few times and checking that all classes were correctly compiled and included in the jar, and I tried running in both MultiMC and the Curse launcher, but I can't figure out why its not working.

 

Any ideas?

Link to comment
Share on other sites

I have two mods I have been developing in parallel: a "core" and an "addon".

Core mods don't mix well with Forge. Skip the core mod and just make the add-on.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

I've been messing around with this a bit more, and I can't figure out what's wrong... My guess is that something is not being built properly, but I can't find what.

 

Build script for deobf jar

Build script for the addon

 

All three (deobf, normal and addon) jar files: http://ge.tt/7zcR9jZ2

 

Once again, everything builds properly with deobf jar in ./libs, but crashes with normal + addon jars in a normal minecraft instance

Link to comment
Share on other sites

I did a few more tests, and I think I found a possible cause for the problem:

 

In the addon's @Mod annotation, it seems that putting 'required-after' instead of 'required-before' for the dependency on the library prevents the NoClassDefFound exception. (I don't see how the load order affects the classpath, but that's a side of Forge I don't know about  :P )

 

However, this causes a problem: It is necessary that all addons have completed their preinit sequence before the library. This is because the library will register a custom model for some of the addon's items, which must be done in preinit (as well as registering items). (It is also preferable that the addons complete their init and postinit sequences before the library)

 

A solution could obviously be to have a method in the library to register the custom models and make the addons call it during preinit, but I don't think it is very elegant because it requires extra work on the addon's side for the "normal" behaviour.

 

Is there an explanation or solution for this problem?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.