[PR #1549] [MERGED] Stop a guest's sprint when its hit knocks back #3578

Closed
opened 2026-11-03 04:10:33 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1549
Author: @ludovic111
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @ludovic111

Base: main ← Head: fix/kb1-sprint-reset


📝 Commits (3)

  • 50aee22 Add a knockback harness: a dedicated server against vanilla's
  • 7c83fbb Travel a guest's server-side velocity, and send hurts after it
  • c33acfd Stop a guest's sprint when its hit knocks back

📊 Changes

10 files changed (+1071 additions, -63 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_actions.rs (+37 -7)
📝 crates/horizon-client/src/game/lan_mobs.rs (+38 -5)
📝 crates/horizon-client/src/game/lan_pvp.rs (+10 -2)
📝 crates/horizon-client/src/game/remote.rs (+9 -0)
📝 crates/horizon-client/src/lan/guest.rs (+4 -0)
📝 crates/horizon-client/src/lan/hub.rs (+29 -10)
📝 crates/horizon-client/src/motion.rs (+128 -39)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/KnockbackClient.java (+444 -0)
📝 tools/lan_e2e.py (+47 -0)
➕ tools/test_server_knockback_parity.py (+325 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Stacked on #1548 (merge #1545, then #1548, first).

What

A guest's (and, on the server thread, the window's) hit with extra knockback now stops its sprint, on the server and on its client, as vanilla's does.

  • leave_guest keeps the sprint stop that a guest's hit on a mob made (stop_sprint_after_extra_knockback used to last only for the hit's turn). A guest hitting a player stops its sprint the same way.
  • The hub sends each guest its own shared flags (crouching, sprinting, gliding) whenever they change (ServerEntity.sendDirtyEntityData sends a player its own data too).
  • A remote client takes the sprinting bit of its own shared flags. It sets the flag only, as SynchedEntityData.assignValues does: the speed modifier and the wasSprinting it compares stay. So it sends START_SPRINTING again only after it has stopped, as a vanilla client does.

Why

Player.causeExtraKnockback ends with setSprinting(false), and the attacker's client learns it from its own entity data. Horizon never sent a guest that flag, so a guest kept sprinting on the server: every hit while running had the sprint knockback. vanilla needs the sprint to be started again (the sprint reset).

Through a vanilla client, against vanilla's server: two sprinting hits a second apart send Bob 0.700 / 0.400, then 0.400 / 0.361, and Alice gets sprinting true, then sprinting false. With #1548 alone, Horizon sends 0.700 / 0.400 twice and no sprint flag. With this PR the packets are the same as vanilla's.

How tested

$ cargo fmt --all -- --check                                   # clean
$ cargo clippy --workspace --all-targets -- -D warnings        # clean (on each branch alone and on the integration commit of all six)
$ cargo test -p horizon-client                                 # 1205 passed, 0 failed (integration commit)
$ python3 tools/test_server_knockback_parity.py
server knockback: 16 of 21 cases identical
$ python3 tools/parity.py --changed origin/main                # 107 passed, 0 failed (integration commit of all six)

This takes pvp-sprint and pvp-sprint-twice out of KNOWN. cow-sprint and zombie-sprint stay, for the yaw (next PR).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1549 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/kb1-sprint-reset` --- ### 📝 Commits (3) - [`50aee22`](https://github.com/horizon-rust/horizon/commit/50aee229966766e850131d5edf6fcd2cd0c9cfdb) Add a knockback harness: a dedicated server against vanilla's - [`7c83fbb`](https://github.com/horizon-rust/horizon/commit/7c83fbb6df401eb4db6a60289cf26e70b55d7c48) Travel a guest's server-side velocity, and send hurts after it - [`c33acfd`](https://github.com/horizon-rust/horizon/commit/c33acfdd058069f7eb256604445cafe2e07dca68) Stop a guest's sprint when its hit knocks back ### 📊 Changes **10 files changed** (+1071 additions, -63 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_actions.rs` (+37 -7) 📝 `crates/horizon-client/src/game/lan_mobs.rs` (+38 -5) 📝 `crates/horizon-client/src/game/lan_pvp.rs` (+10 -2) 📝 `crates/horizon-client/src/game/remote.rs` (+9 -0) 📝 `crates/horizon-client/src/lan/guest.rs` (+4 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+29 -10) 📝 `crates/horizon-client/src/motion.rs` (+128 -39) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/KnockbackClient.java` (+444 -0) 📝 `tools/lan_e2e.py` (+47 -0) ➕ `tools/test_server_knockback_parity.py` (+325 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #1548 (merge #1545, then #1548, first). ## What A guest's (and, on the server thread, the window's) hit with extra knockback now stops its sprint, on the server and on its client, as vanilla's does. - **`leave_guest`** keeps the sprint stop that a guest's hit on a mob made (`stop_sprint_after_extra_knockback` used to last only for the hit's turn). A guest hitting a player stops its sprint the same way. - **The hub** sends each guest its own shared flags (crouching, sprinting, gliding) whenever they change (`ServerEntity.sendDirtyEntityData` sends a player its own data too). - **A remote client** takes the sprinting bit of its own shared flags. It sets the flag only, as `SynchedEntityData.assignValues` does: the speed modifier and the `wasSprinting` it compares stay. So it sends `START_SPRINTING` again only after it has stopped, as a vanilla client does. ## Why `Player.causeExtraKnockback` ends with `setSprinting(false)`, and the attacker's client learns it from its own entity data. Horizon never sent a guest that flag, so a guest kept sprinting on the server: every hit while running had the sprint knockback. vanilla needs the sprint to be started again (the sprint reset). Through a vanilla client, against vanilla's server: two sprinting hits a second apart send Bob 0.700 / 0.400, then 0.400 / 0.361, and Alice gets `sprinting true`, then `sprinting false`. With #1548 alone, Horizon sends 0.700 / 0.400 twice and no sprint flag. With this PR the packets are the same as vanilla's. ## How tested ``` $ cargo fmt --all -- --check # clean $ cargo clippy --workspace --all-targets -- -D warnings # clean (on each branch alone and on the integration commit of all six) $ cargo test -p horizon-client # 1205 passed, 0 failed (integration commit) $ python3 tools/test_server_knockback_parity.py server knockback: 16 of 21 cases identical $ python3 tools/parity.py --changed origin/main # 107 passed, 0 failed (integration commit of all six) ``` This takes pvp-sprint and pvp-sprint-twice out of `KNOWN`. cow-sprint and zombie-sprint stay, for the yaw (next PR). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:10:33 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3578
No description provided.