I've got a "wand" item that, on right-click, I wish to be able to inflict various things on mobs: set on fire or apply a potion effect to them. My two attempts at doing this are below.
Apply a poison potion effect:
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(@Nonnull ItemStack itemstack, World world, EntityPlayer player, EnumHand hand) {
RayTraceResult target = Minecraft.getMinecraft().objectMouseOver;
if (target.typeOfHit == RayTraceResult.Type.ENTITY) {
if (target.entityHit instanceof EntityLivingBase) {