[PR #4936] [MERGED] Combat Parity: reset sprint and slow attacker on sprint-knockback hit #5957

Closed
opened 2026-11-03 05:16:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4936
Author: @elythepreciouscat
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

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


📝 Commits (4)

  • 65e5c14 Reset sprint and apply 0.6 attacker speed cut on sprint-knockback hits
  • 98a1726 Restore vanilla remote knockback ordering
  • c3246b7 Make sprint knockback LAN coverage tick-tight
  • 2f9b57f Keep sprint input held during knockback check

📊 Changes

2 files changed (+53 additions, -28 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+4 -6)
📝 tools/lan_e2e.py (+49 -22)

📄 Description

🤖 Opened by elythepreciouscat's AI agent (Antigravity), not by elythepreciouscat personally.

What and why

Fixes #3736.

Rea 26.3 confirms that MultiPlayerGameMode.attack sends the attack packet, runs Player.attack on the attacking client, and only then lets the normal client tick call sendPosition. A player target is a RemotePlayer, whose hurtClient returns true; ordinary mobs use the base Entity.hurtClient, which returns false.

Player.causeExtraKnockback therefore cuts the attacking client's horizontal velocity by 0.6 and clears sprint only for the remote-player path. The sprint transition is sent by the normal end-of-tick movement synchronization. The immediate was_sprinting mutation, extra STOP_SPRINTING packet, local knockback sound, and shared slowdown in stop_sprint_after_extra_knockback were redundant and also changed mob/spear client behavior. The original warning describing that split is restored.

The remaining remote target gate checks the entity's authoritative minecraft:player kind, which matches Java's RemotePlayer dispatch and does not depend on the profile bookkeeping map arriving first. Mobs still return before the client-side attacker effect.

Vanilla reference

  • MultiPlayerGameMode.attack → Player.attack → Player.causeExtraKnockback.
  • RemotePlayer.hurtClient() returns true; base Entity.hurtClient() returns false.
  • LocalPlayer.sendPosition() calls sendIsSprintingIfNeeded() before movement packets.
  • Player.causeExtraKnockback multiplies X/Z velocity by 0.6 and calls setSprinting(false) when knockback is positive.

Validation

  • python3 tools/test_remote_attack_parity.py: 51,840/51,840 cases match the pinned 26.3 client.
  • cargo test -p horizon-client --lib attack_strength: 8 passed.
  • cargo build --locked --profile fast -p horizon-client --bin horizon-client --bin horizon-ctl: passed.
  • python3 tools/lan_e2e.py --bin-dir target/fast --server-thread --check knockback: passed; both directions measured 1.989 blocks.
  • python3 tools/lan_e2e.py --bin-dir target/fast --server-thread --check sprint-hit-slowdown: passed with attack.hit == true; before speed 0.1532, first post-hit speed 0.042, sprinting false.
  • The LAN sprint check now batches the setup and attack commands in one script so command latency cannot overshoot the target.
  • python3 -m unittest discover -s tests: 481 passed.

Self-check

python3 tools/pr_ready.py --quick on c3246b78e:

Check Result
Scope ✅ 2 files, +43 −28
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 481 passed
rustfmt ✅
clippy ✅
tests: horizon-client ✅ 1233 passed
doc tests ✅ 0 passed
Parity ➖ 356 affected, deferred to CI

🤖 Generated with Codex


🔄 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/4936 **Author:** [@elythepreciouscat](https://github.com/elythepreciouscat) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/sprint-knockback-reset` --- ### 📝 Commits (4) - [`65e5c14`](https://github.com/horizon-rust/horizon/commit/65e5c14a7aabc459875330e946d1170d3fb647f6) Reset sprint and apply 0.6 attacker speed cut on sprint-knockback hits - [`98a1726`](https://github.com/horizon-rust/horizon/commit/98a172637980c67902db8066ed41609f641d9724) Restore vanilla remote knockback ordering - [`c3246b7`](https://github.com/horizon-rust/horizon/commit/c3246b78e48f70fcc9aba1e8b0aa641328e3f3b2) Make sprint knockback LAN coverage tick-tight - [`2f9b57f`](https://github.com/horizon-rust/horizon/commit/2f9b57f78e04e5d41f17263b41294f4906ef6a2d) Keep sprint input held during knockback check ### 📊 Changes **2 files changed** (+53 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+4 -6) 📝 `tools/lan_e2e.py` (+49 -22) </details> ### 📄 Description > 🤖 Opened by elythepreciouscat's AI agent (Antigravity), not by elythepreciouscat personally. ## What and why Fixes #3736. Rea 26.3 confirms that `MultiPlayerGameMode.attack` sends the attack packet, runs `Player.attack` on the attacking client, and only then lets the normal client tick call `sendPosition`. A player target is a `RemotePlayer`, whose `hurtClient` returns true; ordinary mobs use the base `Entity.hurtClient`, which returns false. `Player.causeExtraKnockback` therefore cuts the attacking client's horizontal velocity by 0.6 and clears sprint only for the remote-player path. The sprint transition is sent by the normal end-of-tick movement synchronization. The immediate `was_sprinting` mutation, extra `STOP_SPRINTING` packet, local knockback sound, and shared slowdown in `stop_sprint_after_extra_knockback` were redundant and also changed mob/spear client behavior. The original warning describing that split is restored. The remaining remote target gate checks the entity's authoritative `minecraft:player` kind, which matches Java's `RemotePlayer` dispatch and does not depend on the profile bookkeeping map arriving first. Mobs still return before the client-side attacker effect. ## Vanilla reference - `MultiPlayerGameMode.attack` → `Player.attack` → `Player.causeExtraKnockback`. - `RemotePlayer.hurtClient()` returns true; base `Entity.hurtClient()` returns false. - `LocalPlayer.sendPosition()` calls `sendIsSprintingIfNeeded()` before movement packets. - `Player.causeExtraKnockback` multiplies X/Z velocity by `0.6` and calls `setSprinting(false)` when knockback is positive. ## Validation - `python3 tools/test_remote_attack_parity.py`: 51,840/51,840 cases match the pinned 26.3 client. - `cargo test -p horizon-client --lib attack_strength`: 8 passed. - `cargo build --locked --profile fast -p horizon-client --bin horizon-client --bin horizon-ctl`: passed. - `python3 tools/lan_e2e.py --bin-dir target/fast --server-thread --check knockback`: passed; both directions measured 1.989 blocks. - `python3 tools/lan_e2e.py --bin-dir target/fast --server-thread --check sprint-hit-slowdown`: passed with `attack.hit == true`; before speed 0.1532, first post-hit speed 0.042, sprinting false. - The LAN sprint check now batches the setup and attack commands in one script so command latency cannot overshoot the target. - `python3 -m unittest discover -s tests`: 481 passed. ## Self-check `python3 tools/pr_ready.py --quick` on `c3246b78e`: | Check | Result | | --- | --- | | Scope | ✅ 2 files, +43 −28 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 481 passed | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client | ✅ 1233 passed | | doc tests | ✅ 0 passed | | Parity | ➖ 356 affected, deferred to CI | 🤖 Generated with [Codex](https://openai.com/codex) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:12 +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#5957
No description provided.