Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lumien.randomthings.item;
- import java.util.Iterator;
- import java.util.List;
- import lumien.randomthings.lib.PlayerAbilitiesProperty;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.init.Items;
- import net.minecraft.item.EnumAction;
- import net.minecraft.item.EnumRarity;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.stats.StatList;
- import net.minecraft.world.World;
- public class ItemImmortalityChalice extends ItemBase
- {
- public ItemImmortalityChalice()
- {
- super("chaliceOfImmortality");
- this.setMaxStackSize(1);
- }
- public EnumRarity getRarity(ItemStack stack)
- {
- return EnumRarity.EPIC;
- }
- public int getMaxItemUseDuration(ItemStack stack)
- {
- return 60;
- }
- public EnumAction getItemUseAction(ItemStack stack)
- {
- return EnumAction.DRINK;
- }
- public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
- {
- playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
- return itemStackIn;
- }
- public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn)
- {
- if (!playerIn.capabilities.isCreativeMode)
- {
- --stack.stackSize;
- }
- if (!worldIn.isRemote)
- {
- PlayerAbilitiesProperty abilities = (PlayerAbilitiesProperty) playerIn.getExtendedProperties(PlayerAbilitiesProperty.KEY);
- abilities.setImmortal(true);
- }
- if (!playerIn.capabilities.isCreativeMode)
- {
- if (stack.stackSize <= 0)
- {
- return new ItemStack(Items.glass_bottle);
- }
- playerIn.inventory.addItemStackToInventory(new ItemStack(Items.glass_bottle));
- }
- return stack;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement