package squeek.applecore.example;

import net.minecraft.init.Items;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import squeek.applecore.api.food.FoodEvent;
import squeek.applecore.api.food.FoodValues;

public class FoodValuesModifier
{
	@SubscribeEvent
	public void getFoodValues(FoodEvent.GetFoodValues event)
	{
		if (event.food.getItem() == Items.APPLE)
			event.foodValues = new FoodValues(5, 1f);
	}

	@SubscribeEvent
	public void getPlayerSpecificFoodValues(FoodEvent.GetPlayerFoodValues event)
	{
		if (event.food.getItem() == Items.APPLE)
			event.foodValues = new FoodValues(19, 1f);
		else
			event.foodValues = new FoodValues((20 - event.player.getFoodStats().getFoodLevel()) / 8, 1);
	}
}
@@ -511,32 +511,219 @@
 alues event)%0A%09%7B%0A
+%09%09// Player can be null when, for example, Minecraft caches tooltips at startup,%0A%09%09// and a tooltip handler forwards that null player to AppleCore%0A%09%09if (event.player == null)%0A%09%09%09return;%0A%0A
 %09%09if (event.food

Fix crash at startup due to null player when Minecraft caches tooltips