squeek502 / SpiceOfLife

A Minecraft mod that encourages dietary variety through diminishing returns
The Unlicense
23 stars 26 forks source link

Crash while eating apple #126

Open ColorYak opened 7 years ago

ColorYak commented 7 years ago

Getting a server crash while eating an apple:

[15:14:44] [Server thread/ERROR] [FML]: Exception caught during firing event squeek.applecore.api.food.FoodEvent$FoodEaten@598c907f:
java.lang.NullPointerException
    at squeek.spiceoflife.foodtracker.foodqueue.FixedHungerQueue.trimToMaxSize(FixedHungerQueue.java:66) ~[FixedHungerQueue.class:?]
    at squeek.spiceoflife.foodtracker.foodqueue.FixedHungerQueue.add(FixedHungerQueue.java:23) ~[FixedHungerQueue.class:?]
    at squeek.spiceoflife.foodtracker.foodqueue.FixedHungerQueue.add(FixedHungerQueue.java:5) ~[FixedHungerQueue.class:?]
    at squeek.spiceoflife.foodtracker.FoodHistory.addFood(FoodHistory.java:106) ~[FoodHistory.class:?]
    at squeek.spiceoflife.foodtracker.FoodHistory.addFood(FoodHistory.java:83) ~[FoodHistory.class:?]
    at squeek.spiceoflife.foodtracker.FoodTracker.addFoodEatenByPlayer(FoodTracker.java:165) ~[FoodTracker.class:?]
    at squeek.spiceoflife.foodtracker.FoodTracker.onFoodEaten(FoodTracker.java:41) ~[FoodTracker.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_434_FoodTracker_onFoodEaten_FoodEaten.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:185) [EventBus.class:?]
    at squeek.applecore.asm.Hooks.onPostFoodStatsAdded(Hooks.java:129) [AppleCore-mc1.11.2-2.1.2.jar:?]
    at net.minecraft.util.FoodStats.func_151686_a(SourceFile:33) [acj.class:?]
    at net.minecraft.item.ItemFood.func_77654_b(SourceFile:41) [afd.class:?]
    at net.minecraft.item.ItemStack.func_77950_b(ItemStack.java:201) [afj.class:?]
    at net.minecraft.entity.EntityLivingBase.func_71036_o(EntityLivingBase.java:2688) [sw.class:?]
    at net.minecraft.entity.player.EntityPlayerMP.func_71036_o(EntityPlayerMP.java:1030) [ly.class:?]
    at net.minecraft.entity.EntityLivingBase.func_184608_ct(EntityLivingBase.java:2588) [sw.class:?]
    at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:2004) [sw.class:?]
    at net.minecraft.entity.player.EntityPlayer.func_70071_h_(EntityPlayer.java:232) [aay.class:?]
    at net.minecraft.entity.player.EntityPlayerMP.func_71127_g(EntityPlayerMP.java:329) [ly.class:?]
    at net.minecraft.network.NetHandlerPlayServer.func_73660_a(NetHandlerPlayServer.java:164) [mi.class:?]
    at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.func_73660_a(NetworkDispatcher.java:215) [NetworkDispatcher$1.class:?]
    at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:287) [er.class:?]
    at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:180) [mh.class:?]
    at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:743) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:624) [MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:240) [cch.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) [MinecraftServer.class:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
[15:14:44] [Server thread/ERROR] [FML]: Index: 1 Listeners:
[15:14:44] [Server thread/ERROR] [FML]: 0: NORMAL
[15:14:44] [Server thread/ERROR] [FML]: 1: ASM: squeek.spiceoflife.foodtracker.FoodTracker@527256e3 onFoodEaten(Lsqueek/applecore/api/food/FoodEvent$FoodEaten;)V
[15:14:44] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking player
    at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:195) ~[mh.class:?]
    at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:743) ~[MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:624) ~[MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:240) ~[cch.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) [MinecraftServer.class:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
Caused by: java.lang.NullPointerException
    at squeek.spiceoflife.foodtracker.foodqueue.FixedHungerQueue.trimToMaxSize(FixedHungerQueue.java:66) ~[FixedHungerQueue.class:?]
    at squeek.spiceoflife.foodtracker.foodqueue.FixedHungerQueue.add(FixedHungerQueue.java:23) ~[FixedHungerQueue.class:?]
    at squeek.spiceoflife.foodtracker.foodqueue.FixedHungerQueue.add(FixedHungerQueue.java:5) ~[FixedHungerQueue.class:?]
    at squeek.spiceoflife.foodtracker.FoodHistory.addFood(FoodHistory.java:106) ~[FoodHistory.class:?]
    at squeek.spiceoflife.foodtracker.FoodHistory.addFood(FoodHistory.java:83) ~[FoodHistory.class:?]
    at squeek.spiceoflife.foodtracker.FoodTracker.addFoodEatenByPlayer(FoodTracker.java:165) ~[FoodTracker.class:?]
    at squeek.spiceoflife.foodtracker.FoodTracker.onFoodEaten(FoodTracker.java:41) ~[FoodTracker.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_434_FoodTracker_onFoodEaten_FoodEaten.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:185) ~[EventBus.class:?]
    at squeek.applecore.asm.Hooks.onPostFoodStatsAdded(Hooks.java:129) ~[AppleCore-mc1.11.2-2.1.2.jar:?]
    at net.minecraft.util.FoodStats.func_151686_a(SourceFile:33) ~[acj.class:?]
    at net.minecraft.item.ItemFood.func_77654_b(SourceFile:41) ~[afd.class:?]
    at net.minecraft.item.ItemStack.func_77950_b(ItemStack.java:201) ~[afj.class:?]
    at net.minecraft.entity.EntityLivingBase.func_71036_o(EntityLivingBase.java:2688) ~[sw.class:?]
    at net.minecraft.entity.player.EntityPlayerMP.func_71036_o(EntityPlayerMP.java:1030) ~[ly.class:?]
    at net.minecraft.entity.EntityLivingBase.func_184608_ct(EntityLivingBase.java:2588) ~[sw.class:?]
    at net.minecraft.entity.EntityLivingBase.func_70071_h_(EntityLivingBase.java:2004) ~[sw.class:?]
    at net.minecraft.entity.player.EntityPlayer.func_70071_h_(EntityPlayer.java:232) ~[aay.class:?]
    at net.minecraft.entity.player.EntityPlayerMP.func_71127_g(EntityPlayerMP.java:329) ~[ly.class:?]
    at net.minecraft.network.NetHandlerPlayServer.func_73660_a(NetHandlerPlayServer.java:164) ~[mi.class:?]
    at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.func_73660_a(NetworkDispatcher.java:215) ~[NetworkDispatcher$1.class:?]
    at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:287) ~[er.class:?]
    at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:180) ~[mh.class:?]
    ... 5 more

Spice of Life 1.3.8 on MC 1.11.2.

Config:

" main " {
    B:food.modifier.enabled=true
}
client {
    B:left.click.opens.food.containers=false
}
foodgroups {
}
server {
    B:affect.food.hunger.values=true
    B:affect.food.saturation.modifiers=false
    B:affect.negative.food.hunger.values=false
    B:affect.negative.food.saturation.modifiers=false
    B:clear.history.after.food.eaten.threshold.reached=false
    D:food.containers.chance.to.drop.food=0
    I:food.containers.max.stacksize=2
    I:food.eating.duration.max=0
    D:food.eating.speed.modifier=1.0
    I:food.history.length=30
    B:food.history.persists.through.death=false
    S:food.hunger.rounding.mode=round
    S:food.modifier.formula=MAX(0.25, 1 - hunger_count/20)
    B:give.food.journal.as.starting.item=false
    B:give.food.journal.on.dimishing.returns.start=false
    I:new.player.food.eaten.threshold=6
    B:use.food.groups.as.whitelists=false
    B:use.hunger.restored.for.food.history.length=true
    B:use.time.for.food.history.length=false
    B:use.time.progress.time.while.logged.off=false
}
Scorch-Mechanic commented 7 years ago

Looks like I'm getting an identical crash, though the food is actually a peanut butter and apple jelly sandwich from Harvestcraft. Both ColorYak and myself are using the alternate "food restored for food history length" option, so that's something to note

I don't know how to reproduce this crash, I had an identical sandwich before and no problem. Crash report and config file attached. When I loaded the world up again, the sandwich was unconsumed, but the hunger and saturation was restored. So I ate it again and am back to full hunger and saturation.

crash-2017-05-17_16.47.27-server.txt spiceoflife.txt

squeek502 commented 7 years ago

This might be fixed in 1.3.9, let me know if either of you get this crash after updating.