Mojira Archive
MC-10657

Player entering nether portal while sneaking stuck in 'partial sneak'

The bug

If a player passes through a nether portal while in sneak mode, that player retains some properties of sneaking after coming out on the other side.

  • Cannot open chests, flip levers, etc.
  • Visually appears crouched to other players (including nameplate being hidden by opaque blocks)
  • Moves at full normal speed, despite appearing crouched
  • Falls off of block ledges, despite appearing crouched
  • Able to break and place blocks normally

Effect remains until player presses/releases sneak key.

Video of the behavior:
https://youtu.be/BUkyLzd0c1I


Code analysis by Ben Staddon

Minecraft.setDimensionAndSpawnPlayer creates a new player entity, mostly losing the field values from the old one.
This causes the client to "forget" that the player was previously sneaking, and so it will not send a status update packet to the server as it believes that the sneak status is unchanged, causing the issue.

This issue can be fixed by changing setDimensionAndSpawnPlayer to copy the values used to determine when status update packets are sent (inside EntityPlayerSP.onUpdateWalkingPlayer) across to the newly-created player.