[PR #1550] [MERGED] Aim extra knockback with Mth's sine table #3579

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/1550
Author: @ludovic111
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @ludovic111

Base: main ← Head: fix/kb1-knockback-yaw


📝 Commits (4)

  • 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
  • 6a5c749 Aim extra knockback with Mth's sine table

📊 Changes

11 files changed (+1072 additions, -67 deletions)

View changed files

📝 crates/horizon-client/src/game/enchant_effects.rs (+6 -4)
📝 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 (+320 -0)

📄 Description

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

Stacked on #1549 (merge #1545, #1548 and #1549 first).

What

extra_knockback_direction takes Mth.sin and Mth.cos of the attacker's yaw from vanilla's sine table (horizon_core::geometry::trig), as Player.causeExtraKnockback does: Mth.sin(getYRot() * 0.017453292F).

Why

With f32 sin and cos, an attacker facing east pushed with a z of -4.4e-8 per block of extra knockback. vanilla's table gives exactly 0. The harness reads it in the mob's Motion after a sprinting hit or a Knockback II hit: vanilla has 0.0, Horizon had -2.2e-8 and -4.4e-8.

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)
$ python3 tools/test_server_knockback_parity.py
server knockback: 20 of 21 cases identical
$ python3 tools/parity.py --changed origin/main                # 107 passed, 0 failed (integration commit of all six)

This takes cow-sprint, cow-knockback-2, zombie-sprint and zombie-knockback-2 out of KNOWN. Only pvp-mace is left: a mace smash on a player runs none of MaceItem.hurtEnemy, which is a separate change.

🤖 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/1550 **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-knockback-yaw` --- ### 📝 Commits (4) - [`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 - [`6a5c749`](https://github.com/horizon-rust/horizon/commit/6a5c749f7cfebcb800dd17c0c2cffb01fcc9d7cd) Aim extra knockback with Mth's sine table ### 📊 Changes **11 files changed** (+1072 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/enchant_effects.rs` (+6 -4) 📝 `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` (+320 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #1549 (merge #1545, #1548 and #1549 first). ## What `extra_knockback_direction` takes `Mth.sin` and `Mth.cos` of the attacker's yaw from vanilla's sine table (`horizon_core::geometry::trig`), as `Player.causeExtraKnockback` does: `Mth.sin(getYRot() * 0.017453292F)`. ## Why With f32 `sin` and `cos`, an attacker facing east pushed with a z of -4.4e-8 per block of extra knockback. vanilla's table gives exactly 0. The harness reads it in the mob's Motion after a sprinting hit or a Knockback II hit: vanilla has `0.0`, Horizon had `-2.2e-8` and `-4.4e-8`. ## 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) $ python3 tools/test_server_knockback_parity.py server knockback: 20 of 21 cases identical $ python3 tools/parity.py --changed origin/main # 107 passed, 0 failed (integration commit of all six) ``` This takes cow-sprint, cow-knockback-2, zombie-sprint and zombie-knockback-2 out of `KNOWN`. Only pvp-mace is left: a mace smash on a player runs none of `MaceItem.hurtEnemy`, which is a separate change. 🤖 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#3579
No description provided.