[PR #885] [MERGED] LAN: everyone sees players' arm swings #2886

Closed
opened 2026-11-02 15:59:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/lan-swings


📝 Commits (1)

  • 89cbe03 LAN: everyone sees players' arm swings

📊 Changes

6 files changed (+167 additions, -17 deletions)

View changed files

📝 crates/horizon-client/src/game/agent.rs (+2 -0)
📝 crates/horizon-client/src/game/lan.rs (+8 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+79 -14)
📝 crates/horizon-client/src/game/remote.rs (+19 -0)
📝 crates/horizon-client/src/mobs/ai.rs (+1 -1)
📝 tools/lan_e2e.py (+58 -2)

📄 Description

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

Part of #848 (reported by Tydragon00): "the host doesn't see the guest's mining swing, and the guest doesn't see its own hoe use".

What

  • Swings go to the other players. LivingEntity.swing sends ClientboundSwingAnimationPacket to the trackers (and to the swinging player too for a server-side swing):
    • Every swing a guest makes is now counted (as_guest keeps the guest's own swings_started) and broadcast to the players around it. Before, play.swing was never ticked, so only a guest's first swing ever went out.
    • The host's own swings go to the guests.
    • The host draws the guest's body swinging (updateSwingTime).
  • Mining swings. ServerboundPunchPacket (handlePunch) swings the guest's main hand and resets its attack strength, as vanilla does. The host had ignored it.
  • Server-run uses swing back. A use the server ran that swung the hand (a hoe tilling, an item used on a block, an interaction) is sent back to the guest that made it, as swing(hand, true) does. The guest's client ignores a swing still in its first half (SwingState.startIfAble).
  • The guest client handles SwingAnimation for itself and for other entities, and ticks remote mobs' swings.

Tested

New check swings in tools/lan_e2e.py:

  • Each side mines stone by hand while the other side samples the miner's arm, and sees it swinging. The host is sampled through lan status; with --server-thread, through the remote view.
  • The guest's hoe tills dirt into farmland and swings exactly once.

Self-check

  • cargo fmt --all -- --check: clean.
  • cargo clippy --workspace --all-targets -- -D warnings: clean on this branch.
  • cargo test -p horizon-client -p horizon-protocol: 1019 passed, 0 failed. This ran on an integration commit of the seven #848 / #803 PRs merged together.
  • tools/lan_e2e.py, on that integration build:
    • The #848 / #803 checks (pvp hurt containers machines brewing chest clicks eat eating xp swings plates time light sleep) all pass without --server-thread.
    • With --server-thread, all pass except light, which fails on main too.
    • swings reads state fields that main's agent doesn't have. A probe of the same steps on main reproduced the bug: neither side saw the other swing.
  • Full tools/lan_e2e.py suite compared with main (e508a5ce binaries), with --server-thread:
    • Main fails self walls crafting sign pvp trials xp light.
    • The integration fails self walls crafting sign pvp trials. These fail on main too.
  • Full suite without --server-thread: later checks are order-dependent on main as well, and main fails clicks sleep push. After an earlier check, the guest's client and the server can disagree on where the guest stands, so later interactions are out of reach.
  • tools/parity.py --changed origin/main (95 harnesses) is running on the integration commit. The result will follow in a comment.

🤖 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/885 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/lan-swings` --- ### 📝 Commits (1) - [`89cbe03`](https://github.com/horizon-rust/horizon/commit/89cbe03ebe1a6d54f4a494fcc0402f1768cdc710) LAN: everyone sees players' arm swings ### 📊 Changes **6 files changed** (+167 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/agent.rs` (+2 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+8 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+79 -14) 📝 `crates/horizon-client/src/game/remote.rs` (+19 -0) 📝 `crates/horizon-client/src/mobs/ai.rs` (+1 -1) 📝 `tools/lan_e2e.py` (+58 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #848 (reported by Tydragon00): "the host doesn't see the guest's mining swing, and the guest doesn't see its own hoe use". ## What - **Swings go to the other players.** `LivingEntity.swing` sends `ClientboundSwingAnimationPacket` to the trackers (and to the swinging player too for a server-side swing): - Every swing a guest makes is now counted (`as_guest` keeps the guest's own `swings_started`) and broadcast to the players around it. Before, `play.swing` was never ticked, so only a guest's first swing ever went out. - The host's own swings go to the guests. - The host draws the guest's body swinging (`updateSwingTime`). - **Mining swings.** `ServerboundPunchPacket` (`handlePunch`) swings the guest's main hand and resets its attack strength, as vanilla does. The host had ignored it. - **Server-run uses swing back.** A use the server ran that swung the hand (a hoe tilling, an item used on a block, an interaction) is sent back to the guest that made it, as `swing(hand, true)` does. The guest's client ignores a swing still in its first half (`SwingState.startIfAble`). - **The guest client** handles `SwingAnimation` for itself and for other entities, and ticks remote mobs' swings. ## Tested New check `swings` in `tools/lan_e2e.py`: - Each side mines stone by hand while the other side samples the miner's arm, and sees it swinging. The host is sampled through `lan status`; with `--server-thread`, through the remote view. - The guest's hoe tills dirt into farmland and swings exactly once. ## Self-check - `cargo fmt --all -- --check`: clean. - `cargo clippy --workspace --all-targets -- -D warnings`: clean on this branch. - `cargo test -p horizon-client -p horizon-protocol`: 1019 passed, 0 failed. This ran on an integration commit of the seven #848 / #803 PRs merged together. - `tools/lan_e2e.py`, on that integration build: - The #848 / #803 checks (`pvp hurt containers machines brewing chest clicks eat eating xp swings plates time light sleep`) all pass without `--server-thread`. - With `--server-thread`, all pass except `light`, which fails on main too. - `swings` reads state fields that main's agent doesn't have. A probe of the same steps on main reproduced the bug: neither side saw the other swing. - Full `tools/lan_e2e.py` suite compared with main (e508a5ce binaries), with `--server-thread`: - Main fails `self walls crafting sign pvp trials xp light`. - The integration fails `self walls crafting sign pvp trials`. These fail on main too. - Full suite without `--server-thread`: later checks are order-dependent on main as well, and main fails `clicks sleep push`. After an earlier check, the guest's client and the server can disagree on where the guest stands, so later interactions are out of reach. - `tools/parity.py --changed origin/main` (95 harnesses) is running on the integration commit. The result will follow in a comment. 🤖 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-02 15:59:52 +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#2886
No description provided.