mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 20:42:35 +00:00
Removed all the obsolete methods
Thanks @squeek502
This commit is contained in:
1 parent
e48a3cf7b0
commit
ce9a5405ba
3 files changed
+3
-63
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in new issue
Block a user