Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Crash Problem:
net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Cavern II (cavern)
Caused by: java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "name" is null
at cavern.block.RandomiteHelper.refreshItems(RandomiteHelper.java:42)
at cavern.core.Cavern.onServerStarting(Cavern.java:335)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke(Method.java:580)
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:639)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke(Method.java:580)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:85)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:142)
at com.google.common.eventbus.Subscriber.lambda$dispatchEvent$0(Subscriber.java:71)
at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:31)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:68)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:111)
at com.google.common.eventbus.EventBus.post(EventBus.java:270)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:283)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:261)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke(Method.java:580)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:85)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:142)
at com.google.common.eventbus.Subscriber.lambda$dispatchEvent$0(Subscriber.java:71)
at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:31)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:68)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:111)
at com.google.common.eventbus.EventBus.post(EventBus.java:270)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:197)
at net.minecraftforge.fml.common.Loader.serverStarting(Loader.java:802)
at net.minecraftforge.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:298)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke(Method.java:580)
at net.optifine.reflect.Reflector.callBoolean(Reflector.java:857)
at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:241)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486)
at java.lang.Thread.run(Thread.java:1583)
崩溃原因分析
异常发生在cavern.block.RandomiteHelper.refreshItems方法的第42行,尝试调用String.startsWith()时变量name为null。
代码可能试图检查物品注册名(Registry Name)是否以特定前缀(如"cavern:")开头,但未对name进行空值检查。
某个物品的注册名未被正确赋值(item.getRegistryName()返回null),而Cavern II模组未对此情况进行防御性检查,导致空指针异常。需在代码中增加空值检查。
So we did. And another problem:
错误原因是 IHumidityTile 接口中要求实现 getHumidity 方法,但代码中错误地将方法名拼写为 getHumdiity(多了一个 i)
Fixed.
That's all.
Powered by DeepSeek.