From ce9a5405baa7dc929a3d18c60df4f5bee6701185 Mon Sep 17 00:00:00 2001 From: Vexatos Date: Mon, 25 Aug 2014 09:39:47 +0200 Subject: [PATCH] Removed all the obsolete methods Thanks @squeek502 --- lang | 2 +- .../forestry/core/items/ItemForestryFood.java | 62 +------------------ .../forestry/food/items/ItemBeverage.java | 2 +- 3 files changed, 3 insertions(+), 63 deletions(-) diff --git a/lang b/lang index b4014bcf9..f6643624e 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit b4014bcf98adf28f69a8933bb9978421b9fbe59b +Subproject commit f6643624ef3b3c219e2d6961fdf990e8d13b635c diff --git a/src/main/java/forestry/core/items/ItemForestryFood.java b/src/main/java/forestry/core/items/ItemForestryFood.java index 54d61636e..d490402ac 100755 --- a/src/main/java/forestry/core/items/ItemForestryFood.java +++ b/src/main/java/forestry/core/items/ItemForestryFood.java @@ -15,66 +15,26 @@ import cpw.mods.fml.relauncher.SideOnly; import forestry.core.render.TextureManager; import forestry.core.utils.StringUtil; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; -import net.minecraft.potion.PotionEffect; -import net.minecraft.world.World; import forestry.core.CreativeTabForestry; public class ItemForestryFood extends ItemFood { - private boolean isAlwaysEdible = false; private boolean isDrink = false; - private int healAmount = 0; - private final float saturationModifier; - - private int potionId; - private int potionDuration; - private int potionAmplifier; - private float potionEffectProbability; - public ItemForestryFood(int heal) { this(heal, 0.6f); } public ItemForestryFood(int heal, float saturation) { - super(0, 0, false); - healAmount = heal; - saturationModifier = saturation; + super(heal, saturation, false); setCreativeTab(CreativeTabForestry.tabForestry); } - @Override - public int func_150905_g(ItemStack p_150905_1_) { - return healAmount; - } - - @Override - public float func_150906_h(ItemStack p_150906_1_) { - return saturationModifier; - } - - @Override - public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) { - itemstack.stackSize--; - entityplayer.getFoodStats().addStats(healAmount, saturationModifier); - world.playSoundAtEntity(entityplayer, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); - if (!world.isRemote && potionId > 0 && world.rand.nextFloat() < potionEffectProbability) - entityplayer.addPotionEffect(new PotionEffect(potionId, potionDuration * 20, potionAmplifier)); - - return itemstack; - } - - @Override - public int getMaxItemUseDuration(ItemStack itemstack) { - return 32; - } - @Override public EnumAction getItemUseAction(ItemStack itemstack) { if (isDrink) @@ -83,31 +43,11 @@ public class ItemForestryFood extends ItemFood { return EnumAction.eat; } - @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { - if (entityplayer.canEat(isAlwaysEdible)) - entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack)); - return itemstack; - } - public ItemForestryFood setIsDrink() { isDrink = true; return this; } - public ItemForestryFood setPotionEffect(int i, int j, int k, float f) { - potionId = i; - potionDuration = j; - potionAmplifier = k; - potionEffectProbability = f; - return this; - } - - public ItemForestryFood setAlwaysEdible() { - isAlwaysEdible = true; - return this; - } - @SideOnly(Side.CLIENT) @Override public void registerIcons(IIconRegister register) { diff --git a/src/main/java/forestry/food/items/ItemBeverage.java b/src/main/java/forestry/food/items/ItemBeverage.java index 89e908f35..1e69a1a9a 100755 --- a/src/main/java/forestry/food/items/ItemBeverage.java +++ b/src/main/java/forestry/food/items/ItemBeverage.java @@ -134,7 +134,7 @@ public class ItemBeverage extends ItemForestryFood { IBeverageEffect[] effects = beverage.loadEffects(itemstack); itemstack.stackSize--; - entityplayer.getFoodStats().addStats(beverage.heal, beverage.saturation); + entityplayer.getFoodStats().func_151686_a(this, itemstack); world.playSoundAtEntity(entityplayer, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); if (!Proxies.common.isSimulating(world))