因此,我在某些情况下一直在为矿机进行编码。我的朋友问是要为他创建一个mod。我开始了解Forge API。我以前已经编码过Bukkit / Spigot等。并且在尝试使用Run -> Runconfigurations -> <mymodname>_Client
从Eclipse加载Minecraft时遇到了此错误。这就是发生的情况(在此配置中,主类为GradleStart
,项目为MDKExample,尚未更改名称):
WARNING: An illegal reflective access operation has occurred
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by GradleStart (file:/C:/Users/Lucas/.gradle/caches/minecraft/net/minecraftforge/forge/1.12.2-14.23.5.2808/start/) to field java.lang.ClassLoader.sys_paths
WARNING: Please consider reporting this to the maintainers of GradleStart
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operationsWARNING: All illegal access operations will be denied in a future release
[18:12:51] [main/INFO] [GradleStart]: Extra: []
Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
at net.minecraftforge.gradle.GradleForgeHacks.searchCoremods(GradleForgeHacks.java:85)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:86)
at GradleStart.main(GradleStart.java:25)
我调查了更大的错误,问题是一个ClassCastException
,在第25行的GradleStart
类中,该类在main方法中是(new GradleStart()).launch(args);
。它还在第86行的GradleStartCommon
类上继续,它是net.minecraftforge.gradle.GradleForgeHacks.searchCoremods(this);
,它位于称为launch
的受保护方法中,该方法将args(String [])作为参数。同样,错误发生在第GradleForgeHacks
行的URLClassLoader urlClassLoader = (URLClassLoader) GradleStartCommon.class.getClassLoader();
处,因此看起来这行是主要问题。它说URLClassLoader
无法投射,有什么方法可以从我的mod文件夹中删除(URLClassLoader
部分吗?
我使用的是Java 8 BC,我无法使用其他任何Java版本启动gradlew setupDecompWorkspace和gradlew eclipse。 1.11(我认为)。
仅供参考:我正在Bootcamp MACOSX上使用Windows 10 April 2018(mac上的Windows就像任何Windows设备一样)