The Spice of Life

The Spice of Life

16M Downloads

Eating a spider eye causes client to disconnect?

Time6628 opened this issue · 7 comments

commented

[04:27:30] [Server thread/ERROR] [FML/]: Exception caught during firing event squeek.applecore.api.food.FoodEvent$GetPlayerFoodValues@1c554793: java.lang.NullPointerException at squeek.spiceoflife.foodtracker.FoodHistory.get(FoodHistory.java:244) ~[FoodHistory.class:?] at squeek.spiceoflife.foodtracker.FoodModifier.getFoodModifier(FoodModifier.java:120) ~[FoodModifier.class:?] at squeek.spiceoflife.foodtracker.FoodModifier.getFoodValues(FoodModifier.java:36) ~[FoodModifier.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_800_FoodModifier_getFoodValues_GetPlayerFoodValues.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:72) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:131) [EventBus.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:100) [EventBus.class:?] at squeek.applecore.api_impl.AppleCoreAccessorMutatorImpl.getFoodValuesForPlayer(AppleCoreAccessorMutatorImpl.java:93) [AppleCoreAccessorMutatorImpl.class:?] at squeek.applecore.asm.Hooks.onFoodStatsAdded(Hooks.java:123) [AppleCore-mc1.10.2-2.0.0.jar:?] at net.minecraft.util.FoodStats.func_151686_a(SourceFile:32) [abb.class:?] at net.minecraft.item.ItemFood.func_77654_b(SourceFile:46) [adt.class:?] at net.minecraft.item.ItemStack.func_77950_b(ItemStack.java:168) [adz.class:?] at net.minecraft.entity.EntityLivingBase.func_71036_o(EntityLivingBase.java:2612) [sf.class:?] at net.minecraft.entity.player.EntityPlayerMP.func_71036_o(EntityPlayerMP.java:1002) [lu.class:?] at net.minecraft.entity.EntityLivingBase.func_184608_ct(EntityLivingBase.java:2512) [sf.class:?] at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:1939) [sf.class:?] at net.minecraft.entity.player.EntityPlayer.func_70071_h_(EntityPlayer.java:233) [zs.class:?] at net.minecraft.entity.player.EntityPlayerMP.func_71127_g(EntityPlayerMP.java:303) [lu.class:?] at net.minecraft.network.NetHandlerPlayServer.redirect$onPlayerTick$0(NetHandlerPlayServer.java:230) [me.class:?] at net.minecraft.network.NetHandlerPlayServer.func_73660_a(NetHandlerPlayServer.java:162) [me.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.func_73660_a(NetworkDispatcher.java:213) [NetworkDispatcher$1.class:?] at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:287) [eo.class:?] at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:180) [md.class:?] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:732) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:387) [ld.class:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:613) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:471) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_77]

Using the modpack All The Mods.

commented

Hello. I am also having this problem in our modpack. We are using a custom modpack.

Here is the FML crash report:

[20:24:26] [Server thread/ERROR] [FML/]: Exception caught during firing event squeek.applecore.api.food.FoodEvent$GetPlayerFoodValues@4d2e9c55:
java.lang.NullPointerException
at squeek.spiceoflife.foodtracker.FoodHistory.get(FoodHistory.java:244) ~[FoodHistory.class:?]
at squeek.spiceoflife.foodtracker.FoodModifier.getFoodModifier(FoodModifier.java:120) ~[FoodModifier.class:?]
at squeek.spiceoflife.foodtracker.FoodModifier.getFoodValues(FoodModifier.java:36) ~[FoodModifier.class:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_809_FoodModifier_getFoodValues_GetPlayerFoodValues.invoke(.dynamic) ~[?:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:130) [EventBus.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:99) [EventBus.class:?]
at squeek.applecore.api_impl.AppleCoreAccessorMutatorImpl.getFoodValuesForPlayer(AppleCoreAccessorMutatorImpl.java:93) [AppleCoreAccessorMutatorImpl.class:?]
at squeek.applecore.asm.Hooks.onFoodStatsAdded(Hooks.java:123) [AppleCore-mc1.10.2-2.0.1.jar:?]
at net.minecraft.util.FoodStats.func_151686_a(SourceFile:32) [abb.class:?]
at net.minecraft.item.ItemFood.func_77654_b(SourceFile:46) [adt.class:?]
at net.minecraft.item.ItemStack.func_77950_b(ItemStack.java:168) [adz.class:?]
at net.minecraft.entity.EntityLivingBase.func_71036_o(EntityLivingBase.java:2612) [sf.class:?]
at net.minecraft.entity.player.EntityPlayerMP.func_71036_o(EntityPlayerMP.java:1002) [lu.class:?]
at net.minecraft.entity.EntityLivingBase.func_184608_ct(EntityLivingBase.java:2512) [sf.class:?]
at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:1939) [sf.class:?]
at net.minecraft.entity.player.EntityPlayer.func_70071_h_(EntityPlayer.java:233) [zs.class:?]
at net.minecraft.entity.player.EntityPlayerMP.func_71127_g(EntityPlayerMP.java:303) [lu.class:?]
at net.minecraft.network.NetHandlerPlayServer.redirect$onPlayerTick$zgo000(NetHandlerPlayServer.java:225) [me.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_73660_a(NetHandlerPlayServer.java:162) [me.class:?]
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.func_73660_a(NetworkDispatcher.java:213) [NetworkDispatcher$1.class:?]
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:287) [eo.class:?]
at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:180) [md.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:732) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:387) [ld.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:613) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:471) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_91]

commented
commented

@squeek502: You're right - Sponge is causing the issue due to the fact that we 'reset', rather than completely re-create, EntityPlayerMPs.

One fix could be for Sponge to 'rest' FoodStats instead of re-initializing it - e.g. reset all of the fields to their default values. However, this leaves the root issue unresolved - other mods may too be relying on certain objects being re-created through the EntityPlayerMP constructor, rather than manually by Sponge. We'll probably have to deal with those issues on a case-by-case basis.

Would simply resetting the values (thus leaving the player reference intact) work for you, or would a different approach be better?

commented

That wouldn't be a perfect fix, as AppleCore (and potentially other mods) also makes some assumptions about FoodStats being re-initialized (for example, AppleCore adds a starveTimer field to FoodStats that wouldn't get reset without special compatibility).

Let me know what you think of these fixes on AppleCore's side of things (from squeek502/AppleCore#78):

Some possible fixes:

  • Set the player if it's null every FoodStats.onUpdate. This would basically be a band-aid, and would still fail before the first onUpdate call, but it might work to help resolve issues like this in the future
  • ASM into the modified Sponge code and insert the EntityPlayer into the FoodStats constructor.
commented

I believe this is related to Sponge.

commented

That seems possible, I have not tested compatibility with Sponge.

commented

Should be fixed with SpongePowered/Sponge@384180f.