The bug
If you hit an entity while swimming underwater, the player will stop swimming for a brief moment (it changes the size of its hitbox and returns to the swimming one) and then get stuck in the middle of the water if they try to swim below a block (the player gets stuck when their large hitbox collides with a block, even if they are using a different size hitbox).
How to Reproduce:
Go to an aquifer (flooded cave)
Underwater, spawn an entity:
/summon minecraft:drowned ~ ~ ~ {NoAI:1b,NoGravity:1b,PersistenceRequired:1b}
Swim holding W + Ctrl (don't release these keys)
Hit the entity (you will see that it stops swimming for a moment)
Try to reach the ceiling of the cave.
❌ You will get stuck a block away from the ceiling.
If you stop swimming, it will work normally again.
You can also reproduce this in third person with the hitboxes turned on (F3 + b), and you will see the quick hitbox change that it does when hitting the entity. Watch
[media]to understand this better.
Relates to MC-69459.
Possible side effects of fixing this mentioned in this comment.
The bug can also be triggered when exiting the water in certain circumstances (if there is one block of air between the roof and the water and a block next to where the player comes out) and can cause damage to the player when colliding with a block. (
Linked issues
is duplicated by
Attachments
Comments


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.

Confirmed in 1.20.6 and 24w19b.

Can we hope that this will be fixed in 1.21?

Are you still able to reproduce this on the newest version?

Confirmed in 1.21.3 and 24w45a
@unknown, 24w45a is outdated. Can you reproduce this in 24w46a?

Ah yes today is thursday! Yes, just tested now, it reproduced in 24w46a

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?

Yes, i uploaded it to imgur: https://imgur.com/a/w7eFlUN

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.
Can confirm both cases.
Edit; Version is 1.17 Prerelease 3