[PR #7905] An attack's arm swing is handled in its own tick, not after the move behind it #7887

Open
opened 2026-11-03 07:26:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7905
Author: @Slavik-85
Created: 11/3/2026
Status: 🔄 Open

Base: main ← Head: fix/7817-attack-swing-same-tick


📝 Commits (1)

  • b422e4f lan: an action's arm swing is handled in its tick, past the move behind it

📊 Changes

1 file changed (+72 additions, -18 deletions)

View changed files

📝 crates/horizon-client/src/lan/hub.rs (+72 -18)

📄 Description

🤖 Opened by Slavik-85's AI agent (Claude Code, Opus 5.5), not by Slavik-85 personally.

What and why

Fixes #7817.

Since 0b179e13d (#4524) the hub stops reading a player's packets right after an attack, interaction, use or dig when a move is queued behind it, so the move can't overtake the action the game runs after the hub's pass. It also stopped before the arm swing the client sends right after the action (Minecraft.startAttack: the attack, then swing). The swing starts the attack strength again (handlePunch in game/lan_actions.rs), so handling it a tick late took a tick off the next hit's charge.

With break_vehicle's punches 5 ticks apart, a hit then lands at 4 ticks of charge instead of 5. 0.2 + 0.9² × 0.8 gives 8.48 cart damage instead of 10, net +3.48 a punch after the decay instead of +5, so about 10 punches break the cart instead of 8. That leaves two punches of slack: one 4-tick gap (+1.92) on a loaded machine and 12 aren't enough. That matches what the issue saw: the guest, in its own process, fails on playhorizon, the host's window (same process as its server thread) passes, and the Mac passes. Why a move sits behind the guest's attacks more often than the host's, I couldn't confirm without running the e2e: the first punch always has the look-at turn behind it, and the 20-tick position reminder catches others.

The fix: when a move is queued behind one of those actions, the pass still takes the Punch right at the front of the inbox, then stops. The move waits as before. Vanilla handles the action and its swing in the tick they arrive, and the game already runs the hub's events in order (the action, then the swing), so nothing else moves.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

Minecraft.startAttack sends the attack, then player.swing(MAIN_HAND). The server handles both in the tick they arrive. The swing's handler starts the attack strength again (Player.resetAttackStrengthTicker). VehicleEntity.hurtServer adds the hit's damage × 10 and breaks past 40; the cart's tick takes 1 off. Names as the port's comments give them (game/lan_actions.rs, game/minecarts.rs, break_vehicle in tools/lan_e2e.py). I had no decompiled 26.3 sources on this machine to check them against.

Harness: python3 tools/lan_e2e.py --check minecarts, not run here: this is a Windows machine without the vanilla 26.3 data. Could someone run it on playhorizon, where it failed three times out of three?

Tests

  • New lan::hub::tests::an_attacks_swing_goes_with_it_past_the_move_behind: queues an attack, its swing and a turn. Before the fix the game was handed only [Attack]; now [Attack, Punch], with the turn still queued for the next tick.
  • cargo test -p horizon-client-lib --lib lan::: 171 passed.
  • lan_bot's three a_move_behind_..._waits_for_the_next_tick tests check only that the move waits, which still holds. They need the prepared resources, so they skipped here.
  • rustfmt and cargo clippy -p horizon-client-lib --lib --tests -- -D warnings are clean.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on HIT, against origin/main at 31f83499b, 9 min 1 s)

Check Result
Scope ✅ 1 files, +72 −18
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (3 min 3 s)
rustfmt ✅ (19 s)
clippy ✅ (3 min 52 s)
tests: horizon-client-lib ✅ 1487 passed (1 min 28 s)
doc tests ✅ 0 passed (4 s)
content root tests ➖ content root untouched
mod API up to date ➖ native hooks untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/7905 **Author:** [@Slavik-85](https://github.com/Slavik-85) **Created:** 11/3/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/7817-attack-swing-same-tick` --- ### 📝 Commits (1) - [`b422e4f`](https://github.com/horizon-rust/horizon/commit/b422e4f2b8ada914f4437a1a454ea00597e259f1) lan: an action's arm swing is handled in its tick, past the move behind it ### 📊 Changes **1 file changed** (+72 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/hub.rs` (+72 -18) </details> ### 📄 Description > 🤖 Opened by Slavik-85's AI agent (Claude Code, Opus 5.5), not by Slavik-85 personally. ## What and why Fixes #7817. Since 0b179e13d (#4524) the hub stops reading a player's packets right after an attack, interaction, use or dig when a move is queued behind it, so the move can't overtake the action the game runs after the hub's pass. It also stopped before the arm swing the client sends right after the action (`Minecraft.startAttack`: the attack, then `swing`). The swing starts the attack strength again (`handlePunch` in `game/lan_actions.rs`), so handling it a tick late took a tick off the next hit's charge. With `break_vehicle`'s punches 5 ticks apart, a hit then lands at 4 ticks of charge instead of 5. `0.2 + 0.9² × 0.8` gives 8.48 cart damage instead of 10, net +3.48 a punch after the decay instead of +5, so about 10 punches break the cart instead of 8. That leaves two punches of slack: one 4-tick gap (+1.92) on a loaded machine and 12 aren't enough. That matches what the issue saw: the guest, in its own process, fails on playhorizon, the host's window (same process as its server thread) passes, and the Mac passes. Why a move sits behind the guest's attacks more often than the host's, I couldn't confirm without running the e2e: the first punch always has the `look-at` turn behind it, and the 20-tick position reminder catches others. The fix: when a move is queued behind one of those actions, the pass still takes the `Punch` right at the front of the inbox, then stops. The move waits as before. Vanilla handles the action and its swing in the tick they arrive, and the game already runs the hub's events in order (the action, then the swing), so nothing else moves. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference `Minecraft.startAttack` sends the attack, then `player.swing(MAIN_HAND)`. The server handles both in the tick they arrive. The swing's handler starts the attack strength again (`Player.resetAttackStrengthTicker`). `VehicleEntity.hurtServer` adds the hit's damage × 10 and breaks past 40; the cart's tick takes 1 off. Names as the port's comments give them (`game/lan_actions.rs`, `game/minecarts.rs`, `break_vehicle` in `tools/lan_e2e.py`). I had no decompiled 26.3 sources on this machine to check them against. Harness: `python3 tools/lan_e2e.py --check minecarts`, **not run here**: this is a Windows machine without the vanilla 26.3 data. Could someone run it on playhorizon, where it failed three times out of three? ## Tests - New `lan::hub::tests::an_attacks_swing_goes_with_it_past_the_move_behind`: queues an attack, its swing and a turn. Before the fix the game was handed only `[Attack]`; now `[Attack, Punch]`, with the turn still queued for the next tick. - `cargo test -p horizon-client-lib --lib lan::`: 171 passed. - lan_bot's three `a_move_behind_..._waits_for_the_next_tick` tests check only that the move waits, which still holds. They need the prepared resources, so they skipped here. - rustfmt and `cargo clippy -p horizon-client-lib --lib --tests -- -D warnings` are clean. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on HIT, against origin/main at 31f83499b, 9 min 1 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +72 −18 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (3 min 3 s) | | rustfmt | ✅ (19 s) | | clippy | ✅ (3 min 52 s) | | tests: horizon-client-lib | ✅ 1487 passed (1 min 28 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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>
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#7887
No description provided.