简体   繁体   中英

Minecraft Forge: my Mod Jar file does not load a json library that I used in my code and it does not load one of my GUI textures

I wrote my Minecraft Mod in Forge (version 1.7.10) and I used a json library in my project, as well a custom GUI. However, after I built my .jar file using ./gradle build in the terminal, I installed my Mod in Minecraft by putting it in the mods folder of Minecraft. My mod is recognised in the game and my custom blocks show up. However my custom GUI's texture is not loaded and one of my Java libraries that I used in my project (org.json) is not being recognised. I built my .jar file many times but apparently it doesnt include this library. Is there something wrong with my './gradle build' terminal command? By the way, when I run Minecraft Forge using Eclipse, everything works fine.

In your build.gradle add this:

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

This will copy all the jars in your libs folder into your jar.

that should do it.

if you have something that requires native libraries(for example sqlite)

jar {
    from('native') {
        into('org/sqlite/native')
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM