Mojira Archive
MC-107103

Trying to interact with entity 3 or more blocks away without seeing its eyes only interacts client-side

The bug

Trying to interact with an entity which is 3 or more blocks away without seeing its eyes only causes the interaction to happen only client-side. This can lead to ghost items or other weird behavior.

Example interactions

Interaction Result
Using a Name tag on a mob The mob is named for client, but it can despawn, commands won't find it by the name, and the name disappears after a re-log. The name tag disappears from the inventory (survival) and returns back if you update the slot it was in
Using a Flint and Steel on a creeper Sound of igniting the entity
Milking a cow or a mooshroom (MC-94008) Ghost buckets of milk that become empty buckets if you update them
Shearing a mooshroom Mooshroom disappears until you re-log in
Trying to ride a horse / llama Player is only rotated

How to reproduce (horse)

  1. Summon a horse
  2. Make sure you are three or more blocks away from it and that you cannot see its eyes
  3. Right click the horse
    → The rotation of the horse is applied to you but you did not mount the horse

How to reproduce (name tag)

Creepers in bug.png represent 3 cases (from left to right) in which the mob is behind (glass) blocks.

  • In the 1st and the 2nd case you should stand on sandstone blocks or top of sandstone stairs to reproduce the bug.
  • In the 3rd case you should be at least 2.625 blocks higher than the mob (0.625 = 6 snow layers) and 1 block away from it

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1

The method net.minecraft.network.NetHandlerPlayServer.processUseEntity(CPacketUseEntity) requires the player to see the eyes of the entity (method EntityLivingBase.canEntityBeSeen(Entity)). This check might make no sense because you are not always trying to interact with the head of an entity.