Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package noahc3.AbilityStones;
- import java.util.List;
- import net.minecraft.client.Minecraft;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.potion.Potion;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.world.World;
- public class ItemRegenerationStone extends Item
- {
- public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
- {
- par3List.add("Minutes Remaining: " + (((par1ItemStack.getTagCompound().getInteger("timer"))/20)/60+1));
- }
- if(onRightClick == true)
- {
- if(itemstack .stackTagCompound.getInteger("enabled") == 1)
- {
- itemstack.stackTagCompound.setInteger("enabled", 0);
- }
- else
- {
- itemstack.stackTagCompound.setInteger("enabled", 1);
- }
- }
- EntityPlayer player = Minecraft.getMinecraft().thePlayer;
- private Object inventory;
- //use timer in ticks (24000)
- public ItemRegenerationStone() {
- setMaxStackSize(1);
- setMaxDamage(24000);
- setNoRepair();
- }
- public void onCreated(ItemStack itemStack, World world, EntityPlayer player) {
- }
- @Override
- public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
- {
- //stuff to do when active
- if(itemstack.stackTagCompound == null){
- itemstack.stackTagCompound = new NBTTagCompound();
- itemstack.stackTagCompound.setInteger("timer", 24000);
- itemstack.stackTagCompound.setInteger("enabled", 0);
- }
- EntityPlayer player = (EntityPlayer)entity;
- if(itemstack.stackTagCompound.getInteger("active") == 1)
- {
- itemstack.stackTagCompound.setInteger("timer", itemstack.getTagCompound().getInteger("timer") + -1);
- ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 20, 1));
- }
- if(itemstack.stackTagCompound.getInteger("timer") <= 0){player.inventory.consumeInventoryItem(AbilityStones.itemRegenerationStone);}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement