Skip to content

Commit

Permalink
Fix instances of AppleCore's isFood not being used to determine wheth…
Browse files Browse the repository at this point in the history
…er or not items are foods

 * Fixes things like cake or IEdible implementors not having their stack size modified, being added to villager trades, or having their eating speed modified
  • Loading branch information
squeek502 committed Dec 30, 2014
1 parent 7b71da7 commit 30d5e33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package iguanaman.hungeroverhaul.food;

import net.minecraft.item.ItemFood;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.EnumDifficulty;
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
Expand Down Expand Up @@ -145,7 +144,7 @@ public void onFoodStatsAddition(FoodEvent.FoodStatsAddition event)
@SubscribeEvent
public void onFoodStartEating(PlayerUseItemEvent.Start event)
{
if (IguanaConfig.modifyFoodEatingSpeed && event.item != null && event.item.getItem() instanceof ItemFood)
if (IguanaConfig.modifyFoodEatingSpeed && AppleCoreAPI.accessor.isFood(event.item))
{
int hunger = FoodValues.get(event.item).hunger;
if (hunger > 0)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/iguanaman/hungeroverhaul/util/ItemTweaks.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import iguanaman.hungeroverhaul.config.IguanaConfig;
import squeek.applecore.api.AppleCoreAPI;
import squeek.applecore.api.food.FoodValues;

public class ItemTweaks
Expand All @@ -38,7 +38,7 @@ public static void init()
for (Object obj : Item.itemRegistry)
{
Item item = (Item) obj;
if (item instanceof ItemFood)
if (AppleCoreAPI.accessor.isFood(new ItemStack(item)))
{
ItemStack stack = new ItemStack(item);
FoodValues values = FoodValues.get(stack);
Expand Down

0 comments on commit 30d5e33

Please sign in to comment.