Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
OakPlatinum opened this issue Jan 3, 2025 · 1 comment

Comments

@OakPlatinum
Copy link

OakPlatinum commented Jan 3, 2025

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!

@squeek502
Copy link
Owner

squeek502 commented Jan 4, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants