简体   繁体   English

Minecraft Forge:我的Mod Jar文件未加载我在代码中使用的json库,并且未加载我的GUI纹理之一

[英]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. 我用Forge(1.7.10版)编写了Minecraft Mod,并在项目中使用了json库以及自定义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. 但是,在终端中使用./gradle build构建.jar文件之后,我将Mod放在Minecraft的mods文件夹中,从而将其安装在Minecraft中。 My mod is recognised in the game and my custom blocks show up. 我的mod在游戏中被识别,并且我的自定义方块出现了。 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. 但是,我的自定义GUI的纹理未加载,并且无法识别我在项目(org.json)中使用的Java库之一。 I built my .jar file many times but apparently it doesnt include this library. 我建立了.jar文件很多次,但显然它不包含该库。 Is there something wrong with my './gradle build' terminal command? 我的'./gradle build'终端命令出问题了吗? By the way, when I run Minecraft Forge using Eclipse, everything works fine. 顺便说一句,当我使用Eclipse运行Minecraft Forge时,一切正常。

In your build.gradle add this: 在您的build.gradle中添加以下内容:

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

This will copy all the jars in your libs folder into your jar. 这会将libs文件夹中的所有jar复制到jar中。

that should do it. 应该这样做。

if you have something that requires native libraries(for example sqlite) 如果您有需要本机库的内容(例如sqlite)

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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