Hi, so I have a item that when held adds the regeneration effect to you. But for the regeneration to work it needs to tick down, so I want to call the script that adds the potion every three seconds when the item is held.
This is the script I want called every 3 seconds:
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
super.onUpdate(stack, world, entity, par4, par5);
EntityPlayer player = (EntityPlayer) entity;
ItemStack equipped = player.getCurrentEquippedItem();
if(equipped == stack){
player.addPotionEffect(new PotionEffect(Potion.regeneration.getId(), 60, 2));
}
}
Thanks in advanced!