AppleSkin

AppleSkin

241M Downloads

Food properties in 1.21

SiverDX opened this issue ยท 2 comments

commented

public static QueriedFoodResult query(ItemStack itemStack, Player player)

posts the FoodValuesEvent

public void gatherTooltips(RenderTooltipEvent.GatherComponents event)

calls FoodHelper#query and afterwards posts the event again with the modified values from said event (meaning the modification happens twice)

defaultFood is also not final, meaning other mods could modify it

for neoforge I also recommend using getFoodProperties instead

commented

Addressed in v3.0.5, thanks for the report!

commented

The double event is a bug.


defaultFood being non-final is intentional, since the use-case this was originally designed for was Hunger Overhaul + The Spice of Life working together, so:

  • Hunger Overhaul changed the default and modified values for every food
  • The Spice of Life changed the modified food values (depending on how often that food has been eaten by that player), but left the default alone

AppleSkin can then render the tooltip like this (this is from an old AppleSkin version):


getFoodProperties does seem like the better thing to use