mojira.dev
MC-220390

Players can get stuck when attempting to swim under blocks after having previously attacked an entity

The bug

If a player holds the sprint key to swim, hits an entity, and tries to swim under blocks without ever releasing sprint, they get stuck in place and jitter.

This is due to a client-server desync when the player attacks while holding the sprint key. When hitting an entity, the server thinks the player's hitbox reverts to its normal standing size, while the client continues swimming with a smaller hitbox. As a result, when the player tries to swim beneath a block, the server stops them due to the standing hitbox colliding with the block, while the client keeps trying to advance with the smaller swimming hitbox.

This bug occurs fairly often while fighting Guardians in the Ocean Monument, making it harder to experience the dungeon as intended.

Steps to reproduce

  1. Get inside an Ocean Monument:

    /locate structure minecraft:monument
  2. If needed, spawn an entity:

    /summon minecraft:guardian ~ ~ ~ {NoAI:1b,NoGravity:1b,PersistenceRequired:1b}
  3. Swim by holding Ctrl + W (don't release these keys).

  4. Hit the entity.

  5. Try to reach the ceiling of the Ocean Monument.

Observed behavior

Player gets stuck a block away from the ceiling and jitters.

Expected behavior

Player would reach the ceiling.

Additional notes

  • This bug is a direct product of MC-69459. Fixing MC-69459 would likely fix this issue.

  • The comments mention possible side effects a fix could have on PvP.

Linked issues

MC-273575 swimming under ice sometimes locks me in place Resolved MC-273384 Freezing in place swimming after sprint attacking Resolved MC-277194 Player freezes when sprint-swimming underneath a block Resolved MC-279066 If player swimming and any mob will hurt him in close combat, he will not be able to swim into holes below 3 blocks Resolved MC-128846 Players can get stuck in their position and constantly jitter when attempting to swim through small spaces after having previously attacked an entity while swimming Resolved

Attachments

Comments 16

Can confirm both cases.

 

Edit; Version is 1.17 Prerelease 3

Just going to detail something here, you can add it to the report if you want: the thing that causes this is if you continue holding ctrl after u hit something, you go into a state where you can sprint but the game thinks you're walking (so for example you can do critical hits while sprinting by doing this). This is a major component for PvP, so if this bug were to be fixed, it would need to be a fix that keeps the existing behavior while sprinting but just fixes it while swimming.

Can confirm in 23w12a

This is a direct product of MC-69459. Basically, because the server thinks that the player is no longer sprinting after hitting an entity, the player cannot swim through small spaces or under blocks causing them to constantly jitter. Fixing MC-69459 would very likely also fix this issue (MC-220390).

This ticket also relates to MC-129568.

Fixing MC-69459 messes with PvP, I suspect this is why it has not been fixed. I'm sure this swimming bug could be fixed without breaking the behavior for sprinting.

6 more comments

Btw, I’d like to add that this bug prevents players from fighting in the Ocean Monument, as they get stuck in water while the Guardian attacks them with its laser.
So the problem isn’t just situational; it directly affects gameplay in this structure and makes it harder to fully experience the dungeon as intended

I would like to reiterate that the fixing of MC-69459 to fix this bug would negatively effect PvP in a substantial way. The desync allows doing critical hits while sprinting by continuing to hold ctrl after connecting a sprint-knockback attack. This is a massive part of PvP and adds a lot of depth, removing the desync entirely would be a terrible change. The side effects of the desync, such as this bug, should really be the only things fixed.

Can you send a video of when you reproduced this?

Simple way of showing it is to add a scoreboard with minecraft.custom:minecraft.swim_one_cm and observe that it stops ticking if you punch a mob while swimming.

Interestingly enough, if you via a datapack (

[media]

) give the player blindness and clear it roughly 2 ticks later, it will force the client and server to start agreeing again. Shame it seems only blindness fixes it, so not the most subtle workaround.

SoloAlguien

(Unassigned)

Confirmed

Platform

Important

Hitboxes, Networking, Player

client-side, hitbox, player, server-side, swim

Minecraft 18w16a, 1.16.1, 1.16.4, 20w51a, 1.16.5, , 24w46a, 1.21.4, 1.21.8, 26.2, 26.3 Snapshot 9

Retrieved