I created my own item, and overrode getItemUseAction, but right-clicking had no effect. So then I also overrode onItemRightClick, using the code from the ItemPotion class:
public class ItemLemonade extends Item {
@Override
public EnumAction getItemUseAction(ItemStack stack) {
return EnumAction.DRINK;
}
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
playerIn.setActiveHand(handIn);
return new ActionResult<>(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn));
}
}
Now right-clicking does an animation when I've equipped the potion, but it's a different animation from the one with a regular potion (the potion just goes up and down in the character's right hand instead of centering like a potion). How do I recreate the animation of a regular potion?
Also, how do I add in the sound effect that occurs when drinking a regular potion?