Mojira Archive
MC-76416

Player can interact with dying mobs

The bug

Player can interact with with mob while their dying animation is happening. This can partwise result in mobs in invalid states, entity "duplication" and other unwanted situations.

Affected situations

Situation Note
shearing sheep -
taming wolf results in alive tamed wolf with dying animation
taming ocelot -
feeding (baby) animal -
shearing mushroom -
using name tag -
using leash leash is used but instantly dropped at position of mob
using flint and steel on creeper creeper is not ignited but flint and steel loses durability
shearing snowman -
saddling pig -
using spawn egg on breedable mob -

How to reproduce (sheep)

  1. Spawn a Sheep
  2. Punch sheep 7 times with bare hands
  3. Punch and shear the sheep at the same time (left and right click quickly)
  4. You will get 4 blocks of wool

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1

The problem is that the method net.minecraft.entity.player.EntityPlayer.interactOn(Entity, EnumHand) does not prevent interaction with dying mobs. Or all methods overriding the method net.minecraft.item.Item.itemInteractionForEntity(ItemStack, EntityPlayer, EntityLivingBase, EnumHand) or net.minecraft.entity.EntityLiving.processInteract(EntityPlayer, EnumHand).