[PR #627] [MERGED] Swap and sync the off hand on a server #2680

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

📋 Pull Request Information

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

Base: main ← Head: fix/offhand-on-server


📝 Commits (1)

  • 24ac4e1 Swap and sync the off hand on a server

📊 Changes

3 files changed (+45 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+7 -1)
📝 crates/horizon-client/src/game/lan_actions.rs (+6 -1)
📝 crates/horizon-client/src/game/remote.rs (+32 -0)

📄 Description

Fixes #543

What was wrong

On a server, the off hand did nothing:

  • F swapped the hands only on the client, so the server never saw the torch move.
  • The client dropped the server's inventory slot 45 (the off hand in the player menu) and SetPlayerInventory slot 40, so a torch the server put there never showed.
  • The Horizon host ignored player action 7 (SWAP_ITEM_WITH_OFFHAND).

What changed

  • game/remote.rs: the player inventory menu maps slot 45 to the off hand, SetPlayerInventory 40 sets the off hand, and a new remote_swap_hands sends PlayerAction 7 as LocalPlayer does.
  • game.rs: F on a remote server sends the action (not for spectators) and waits for the server's slot updates; single player is unchanged.
  • game/lan_actions.rs: the host handles action 7 for non-spectators by swapping the guest's hands and stopping any item use, as ServerGamePacketListenerImpl does.

Verification

  • cargo fmt --all --check and cargo clippy -p horizon-client --all-targets -- -D warnings are clean.
  • New test every_inventory_menu_slot_is_a_game_slot_and_45_is_the_off_hand (cargo test -p horizon-client --bin horizon-client) passes.
  • The lib tests and tools/parity.py --changed origin/main run once on an integration commit with the other multiplayer fixes; the results will be posted here.

🤖 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/627 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/offhand-on-server` --- ### 📝 Commits (1) - [`24ac4e1`](https://github.com/horizon-rust/horizon/commit/24ac4e149bac81e29676bc9175c264f4012b9b42) Swap and sync the off hand on a server ### 📊 Changes **3 files changed** (+45 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+7 -1) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+6 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+32 -0) </details> ### 📄 Description Fixes #543 ## What was wrong On a server, the off hand did nothing: - **F** swapped the hands only on the client, so the server never saw the torch move. - The client dropped the server's inventory slot 45 (the off hand in the player menu) and `SetPlayerInventory` slot 40, so a torch the server put there never showed. - The Horizon host ignored player action 7 (`SWAP_ITEM_WITH_OFFHAND`). ## What changed - `game/remote.rs`: the player inventory menu maps slot 45 to the off hand, `SetPlayerInventory` 40 sets the off hand, and a new `remote_swap_hands` sends `PlayerAction` 7 as `LocalPlayer` does. - `game.rs`: F on a remote server sends the action (not for spectators) and waits for the server's slot updates; single player is unchanged. - `game/lan_actions.rs`: the host handles action 7 for non-spectators by swapping the guest's hands and stopping any item use, as `ServerGamePacketListenerImpl` does. ## Verification - `cargo fmt --all --check` and `cargo clippy -p horizon-client --all-targets -- -D warnings` are clean. - New test `every_inventory_menu_slot_is_a_game_slot_and_45_is_the_off_hand` (`cargo test -p horizon-client --bin horizon-client`) passes. - The lib tests and `tools/parity.py --changed origin/main` run once on an integration commit with the other multiplayer fixes; the results will be posted here. 🤖 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:58:11 +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#2680
No description provided.