/** Copyright (C) <2017> <coolAlias> This file is part of coolAlias' Zelda Sword Skills Minecraft Mod; as such, you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package zeldaswordskills.item; import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import zeldaswordskills.creativetab.ZSSCreativeTabs; public class ItemPotionPurple extends ItemDrinkable { protected final int restore_hunger; protected final float saturation; public ItemPotionPurple(String name, int restore_hunger, float saturation) { super(name); this.restore_hunger = restore_hunger; this.saturation = saturation; setMaxStackSize(1); setCreativeTab(ZSSCreativeTabs.tabTools); } @Override public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player) { if (!player.capabilities.isCreativeMode) { --stack.stackSize; } player.getFoodStats().addStats(restore_hunger, saturation); return super.onItemUseFinish(stack, world, player); } @Override public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { return true; } @Override @SideOnly(Side.CLIENT) public boolean hasEffect(ItemStack stack) { return true; } @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean advanced) { list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocalFormatted("tooltip.zss.restore_stamina", restore_hunger)); } }