So, I want to create an item that will give potion effect for a short time when the item is right clicked and take damage. I've set up a boolean for onItemRightClick.
public boolean onItemRightClick(ItemStack itemstack, EntityPlayer player, World world){
return false;
}
but I'm not sure how to take it from here. Also I want there to be a message displayed to the player when they use the item.
public boolean onItemRightClick(ItemStack itemstack, EntityPlayer player, World world)
{
if(!world.isRemote)
{
//This will add regeneration to the player for a second! To Set it to more seconds, you'll have to do this: secondsYouWantIt * 20.
//So If you want it for 15 seconds, you'll do: 15 * 20 which will be 300!
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 20);
//This Line will print 'Hello! I'm A Message' to the player's screen! Change the Quote to what you want to say!
player.addChatMessage(new ChatComponentTranslation("Hello! I'm a Message");
}
return false;
}
public boolean onItemRightClick(ItemStack itemstack, EntityPlayer player, World world){
return false;
}
but I'm not sure how to take it from here. Also I want there to be a message displayed to the player when they use the item.
Hello!