Growthcraft Community Edition

Growthcraft Community Edition

1M Downloads

Ticking player exception on drinking skim milk

Syndaryl opened this issue · 19 comments

commented

I was able to drink some before, but now when I drink a bottle of skim milk I crash with a ticking player exception.

latest.log
crash-2018-10-21_09.48.02-server.txt

commented

I'm using the latest Dev build "growthcraft-1.12.2-4.0.4.200.DEV.77869ce" and believe my crashing is related to this issue:
https://paste.dimdev.org/ahecerehef.mccrash

commented

Just checked the code. In the original MC code a null pointer access wouldn't occur (because it accesses only the passed "this" handle which is never null). Looks like some coremod has modified the method.

I've seen that you have a plenty of core mods active. Would it help if you find and disable a mod providing a core mod? You will find all used core mods in the log after the table with used mods.

commented

If I had to guess, it would be AppleCore - which is a popular mod that relates directly to food. Other items (growthcraft or no) do not create the issue, which is odd.

commented

Tested it now with only AppleCore, but it worked. Maybe it is some other coremod or a different mod is influencing the AppleCore behavior.

commented

Tested with Growthcraft 4.0.4.300 and cannot duplicate. Drinking skim milk with full bar consumed it and added speed.

This issue has been stale for 20 days. There is another mod in your pack that might be causing the issue.

commented
commented

Still getting it with the current build. I'll look into potion ID conflict

commented

Well. All logs presented here are indicating that coremods are used. Please find and disable the responsible coremod first.

Obviously a coremod overwriting net.minecraft.util.FoodStats.addStats() is causing the crash. This is the original MC method:

    public void addStats(ItemFood foodItem, ItemStack stack)
    {
        this.addStats(foodItem.getHealAmount(stack), foodItem.getSaturationModifier(stack));
    }

A null pointer exception can't occur here, because foodItem is never null when calling

player.getFoodStats().addStats(this, stack);

And stack is not used directly in the method. If a null pointer exception would occur in connection to it, then it would do so inside getHealAmount() or getSaturationModifier(), but not in addStats().

commented

So here's the fun thing. I copied my profile and removed all the coremods (and their dependents). No surprise, the crash goes away.

However, I add them back one-by-one to find the offender, and the crash has not reappeared yet. (As mentioned in the original report, it works for a while, then abruptly stops.)

Going through the code, I'm pretty certain it's AppleCore - but it works with other foods and drinks from Growthcraft and other mods, and it even works with Skim Milk ... for a while. And then it never works again and I have no idea why.

commented

Do you have a new crash log without the coremods?

commented

Trying to provoke it. I think it's going to take a few hours of playtime.

commented

Stripping it down to just AppleCore and Growthcraft certainly doesn't do it, even though AppleCore definitely hooks in to all the food stuff.

commented

I apologize for not getting back to this issue as I've had alot going on the past month plus the holiday season.

A question I wondering is if this is some issue to do with Applecore, then would there be a similar issue with Appleskin?

commented

Appleskin makes no core edits. It is just a cosmetic client-side mod.

commented

It logically must be AppleCore, but I don't know why it'll be happy for hours and then suddenly crap out, and ONLY on skim milk. So I'm digging around in the code.
A new event is injected at:

ModuleFoodStats.java

Said event is hiding over here:

Hooks.java

and that FoodValues that gets instantiated is

FoodValues.java

But that means either player is null (doesn't make sense) or the int and float hunger and saturation values are null, which isn't a thing.

commented

Ah. I have full hunger (but not full saturation) - this is probably why it's crashing.

Expected behavior is that either it would prevent me from drinking (like vanilla food) or it would behave like buttermilk and allow me to eat and increase my stats without crashing.

commented

That's bizarre

I don't know how that line works actually, but I'm going to assume something is funky about that call

Just from the surrounding it's signature would be addStats(Item, ItemStack), which is redundant, as you can get the item from the ItemStack with getItem(), maybe someone else knows what's up with that

This could be related to #20 as well

commented

Update: I did some experimenting and I crash even if I don't have full hunger - even if I have lost a substantial amount of hunger and can't possibly "Overflow".

commented

I'm going to close this one out as i think everyone agrees that it is to an external core mod from Growthcraft.