配置MDK指南
首页
捐助作者 (opens new window)
GitHub (opens new window)
首页
捐助作者 (opens new window)
GitHub (opens new window)
  • 首页
  • 常见问题

    • 运行 runClient 时无法加载资源
    • 运行游戏时FML导致崩溃
      • 解决方案
      • 参考资料
    • 编码GBK的不可映射字符
    • 不支持 diamond 运算符
    • 找不到命令 gradlew
    • 找不到任务 setupDecompWorkspace
    • PKIX 路径构建失败
    • 环境变量'assetDirectory'必须为有效路径
    • 无法找到 net.minecraft:client
    • ProjectScopeService 已被关闭
    • Path.getFileName() 为空
    • 无法下载 fastutil.jar

运行游戏时FML导致崩溃

# 运行游戏时FML导致崩溃

于ForgeGradle 3.+版本(Forge 1.12.2-14.23.5.2854及以上版本)运行游戏时崩溃,日志提示:Caught exception from Forge Mod Loader (FML)。

详细崩溃报告
net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Forge Mod Loader (FML)
Caused by: java.lang.NullPointerException
	at net.minecraftforge.fml.common.network.NetworkRegistry.newChannel(NetworkRegistry.java:207)
	at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.registerChannel(FMLNetworkHandler.java:185)
	at net.minecraftforge.fml.common.FMLContainer.modConstruction(FMLContainer.java:92)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
	at com.google.common.eventbus.EventBus.post(EventBus.java:217)
	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219)
	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
	at com.google.common.eventbus.EventBus.post(EventBus.java:217)
	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136)
	at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:595)
	at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:232)
	at net.minecraft.client.Minecraft.init(Minecraft.java:467)
	at net.minecraft.client.Minecraft.run(Minecraft.java:378)
	at net.minecraft.client.main.Main.main(SourceFile:123)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.legacydev.Main.start(Main.java:86)
	at net.minecraftforge.legacydev.MainClient.main(MainClient.java:29)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

# 解决方案

在build.gradle文件的dependencies块中添加以下代码:

dependencies {
    // 添加以下代码强制使用旧版本mergetool
    implementation ("net.minecraftforge:mergetool:0.2.3.3") { force = true }

    // 其它依赖...
}
1
2
3
4
5
6

随后删除C:\Users\<当前用户>\.gradle\caches\forge_gradle\minecraft_user_repo\net\minecraftforge\forge\1.12.2-14.23.5.xxxx_mapped_snapshot_xxxxxxxx-1.12或正在使用的Forge版本的文件夹,重新同步Gradle后修复。

如果上述方法无法修复,则可能是类路径中包的加载顺序问题,尝试使用fg.deobf提前mergetool的加载顺序:

dependencies {
    // 添加以下代码强制使用旧版本mergetool
    implementation fg.deobf("net.minecraftforge:mergetool:0.2.3.3:forge") { force = true }

    // 其它依赖...
}
1
2
3
4
5
6

# 参考资料

  • Minecraft Forge Mod Loader (FML) Loading and crashing MC (opens new window)
编辑此页面 (opens new window)
运行 runClient 时无法加载资源
编码GBK的不可映射字符

← 运行 runClient 时无法加载资源 编码GBK的不可映射字符→

Theme by Vdoing
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式