mojira.dev
MC-268008

Sneak desync between client and server

Expected behaviour

Whenever the player model is sneaking, the is_sneaking predicate should return true, and the sneak_time scoreboard should go up.

Observed behaviour

In some scenarios, the predicate returns "false" even if the player sneaks. In particular, this happens when keeping shift held after dismounting an entity.

This indicates a desync between client and server. The server sees you stand normally, while client-side you're crouching.

Steps to reproduce

  1. Track sneaking time, using either (or both) of the following two options:

    • Set up a "sneak_time" scoreboard:

      /scoreboard objectives add sneaktime minecraft.custom:minecraft.sneak_time)

      and display it in the sidebar:

      /scoreboard objectives setdisplay sidebar sneaktime
    • Set up a datapack with an is_sneaking predicate, then place down a command block that checks for it

  2. Mount an entity (/ride or manually; easiest is a boat). Immediately dismount and keep holding the sneak button.

  3. Notice how the sneak_time scoreboard doesn't increment (or how the predicate doesn't return true)

Attachments

Comments 8

I just tested it in multiplayer, and apparently the server things I'm standing. Other people don't see me sneaking at all.

Also, apparently performing this bug lets you clip into the floor. Tested with boats. Not sure if it happens for the same reasons though

Does MC-231283 describe your issue? To me, it seems like it does. While not explicitly stated in that issue, it describes the behavior of the 'is_sneaking' predicate not properly detecting a 'flying' (in your case, a player who is mid-air after getting off a horse).

MC-231283 does not describe the bug I'm describing.
My bugreport isn't about an inconsistency between the scoreboard and the predicate, but instead the fact that the setup I described puts you into a state where you're crouching client-side but not serverside (So neither the scoreboard OR the predicate trigger). I realised that after I made the bugreport, so the title I chose is misleading. I edited the title and made an extension in the bugreport to make it clearer.

To make this easier to reproduce, could you please attach a simple data pack for reproducing this? Thanks!

I sadly can't provide a datapack in the next few days, but the /tick command makes this trivial:

  • /tick rate 5 (for example, can be lower too)

  • Place a boat

  • Rightclick it and immediately start crouching and hold it

  • => You'll dismount the boat and will be sneaking client-side, but other players will see you stand and the scoreboard will also not increment (And the predicate won't return "true" either)

Confirmed; happens in 1.20.4 as well.

Confirmed in 1.21.4 Pre-Release 3

SilicatYT

(Unassigned)

Confirmed

Platform

Important

Networking

1.20.4, 24w03b, 1.20.5 Pre-Release 3

Retrieved