AppleSkin

AppleSkin

247M Downloads

[BUG] NullPointerException: Cannot invoke "net.minecraft.class_4174.comp_2491()" because "defaultFood" is null

OakPlatinum opened this issue ยท 1 comments

commented

LOG LINK: https://mclo.gs/PFckcFp

                        biggestHunger = Math.max(defaultFood.nutrition(), modifiedFood.nutrition());

https://github.com/squeek502/AppleSkin/blob/1.21-fabric/java%2Fsqueek%2Fappleskin%2Fclient%2FTooltipOverlayHandler.java#L99-L99

I have no idea why defaultFood can be null, but it's always good to check if it's null before calling the method, I guess. Thanks!

commented

My tentative guess is that some mod is setting defaultFoodComponent to null during FoodValuesEvent, which is not currently an intended use-case.

Ideally it'd be good to confirm my guess is correct. If you can reproduce the crash easily and would like to help narrow it down, you could try:

  • Start the game with only AppleSkin and Fabric API installed and see if it still occurs
  • If it doesn't, add back half of the mods you had installed
    • If it occurs now, then remove half of those you added back until it stops, and then add back half, etc until you find the particular mod that causes it
    • If it still doesn't occur, then check the other half in the same way mentioned above