Jump to content

[1.7.10] Include external library? [solved again]


Recommended Posts

I wrote a little utility to get the class names of all the monsters from all my loaded mods, so I can set up iChun's morph mod to support all my mods :) I made a cruddy little wand that when you right click it, it dumps all the mob classnames to a log file. This means I can be sure I'm dumping my list after all mods have initialized and created their monsters. It relies on a library that isn't part of my mod, Minecraft, Forge, or the standard Java distribution;  the library is org.reflections from https://github.com/ronmamo/reflections

I built the library locally using maven, it works if I make little programs testing it in eclipse so I'm pretty sure it's built right. It was built into "reflections-0.9.11-SNAPSHOT.jar"


Unfortunately, while I can build (with gradle) my code using the library, when I right-click my wand and invoke org.reflections, Minecraft dies with a java.lang.NoClassDefFoundError (specifically complaining about org.reflections).


What I've done:

I've added reflections-0.9.11-SNAPSHOT.jar to the libs folder in my project.

I added the following to my build.gradle

dependencies {

    compile files(





That lets everything build nicely, but as mentioned Minecraft throws a java.lang.NoClassDefFoundError in the onItemRightClick on my object as it creates a new org.reflections.Reflections.


I tried using -classpath to tell java where my built classes for org.reflections are, and then where the buit jar was, when starting Minecraft but no behavior change.


I experimentally copied reflections-0.9.11-SNAPSHOT.jar into my mods folder, but it didn't change the behavior, presumably because the library is not a mod, so Forge doesn't load it.

And then, flailing a little, I moved it into mods\1.7.10 but naturally that doesn't work either.


As another experiment, I cracked open my mod and the reflections .jar, and merged the contents into my mod. I really would have thought that would make the classes visible but no change. Sad panda.


I'm flailing around a bit much so now I come to you to find out how I'm supposed to use this external library jar with my mod? Please?

Link to comment
Share on other sites

OK, I'm back. Gradle and I are having an argument still, this time about the srgExtra line. I read through the entire Shading article, and I looked at the sample Shading recipe. I just can't get it to build.



:reobf FAILED


FAILURE: Build failed with an exception.


* What went wrong:

Execution failed for task ':reobf'.

> Unable to parse srg file, unrecognized mapping type in line=CL:org/reflections/* com/syndaryl/minecraft/dumpentitylist/org/reflections/*




I've put my project up on git, the build.gradle is at https://github.com/Syndaryl/dumpentitylist/blob/master/build.gradle


I tried a PK (package) based remap first, that failed too. As far as I can tell from the source, CL and PK should be the part being referred to for that error, but those are also, according to the source, correct.  :-\

I feel like I must be just a little bit off somewhere.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now


  • Create New...

Important Information

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