Stop a guest's sprint when its hit knocks back

Player.causeExtraKnockback stops the attacker's sprint on the server, and
the shared flag reaches the attacker's own client (ServerEntity sends a
player its own dirty entity data). A guest's sprint was only stopped on
the server copy for the length of the hit and never sent, so a guest (and,
on the server thread, the window) kept sprinting: every hit while
sprinting had the sprint knockback, where vanilla's needs the sprint to
start again.

- leave_guest keeps the sprint stop a guest's hit made; a guest hitting a
  player stops its sprint too.
- The hub sends each guest its own shared flags (crouching, sprinting,
  gliding) when they change.
- A remote client takes the sprinting bit of its own shared flags (the
  flag only, as vanilla's assignValues: the speed modifier and the
  wasSprinting it compares stay, so it sends START_SPRINTING again only
  after it has stopped).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-24 11:13:27 +02:00
parent 7c83fbb6df
commit c33acfdd05
6 changed files with 63 additions and 18 deletions
+2 -5
View File
@@ -56,15 +56,12 @@ PROPERTIES = {
'pause-when-empty-seconds': '-1',
}
# Cases Horizon still gets wrong, and why.
SPRINT = "the server never sends a guest its own sprint flag, so a sprint hit doesn't stop the attacker's sprint"
YAW = "the extra knockback's direction comes from f32 sin/cos, not Mth's sine table (z is -2e-8 a block, not 0)"
KNOWN = {
'cow-sprint': f'{SPRINT}; {YAW}',
'cow-sprint': YAW,
'cow-knockback-2': YAW,
'zombie-sprint': f'{SPRINT}; {YAW}',
'zombie-sprint': YAW,
'zombie-knockback-2': YAW,
'pvp-sprint': SPRINT,
'pvp-sprint-twice': SPRINT,
'pvp-mace': "a smash on a player runs none of MaceItem.hurtEnemy (the attacker's fall goes on)",
}