Fabrication

Fabrication

305k Downloads

Some foods not restoring health with No Hunger tweak

anoomolu opened this issue ยท 0 comments

commented

Essentially #705 with only the actual buggy part - Pufferfish, Tropical Fish, Dried Kelp, Potatoes and Cake do not restore any health with the No Hunger tweak enabled.

I really don't know Java, but if I were to hazard a guess, does int round down all subsequent values?

heal((int)((food.getHunger()+food.getSaturationModifier())*0.75f));

e.g. Potatoes restore 1 hunger and 0.6 saturation, rounded down to 1 and 0 respectively. 0.75x the sum rounds down to 0, so potatoes don't heal.

This would make the above foods (minus Cake) restore less than 1 point of health, leading to the observed lack of healing?

It seems like the code gets the hunger and saturation values from the food in hand, which might explain why Cake doesn't heal (no eating action occurs so nothing is checked?).

Observed on Fabrication for 1,20.1, and Forgery for 1.16.5.