[PR #471] [MERGED] LAN guest: their own ender chest, and double chests as 9x6 #2586

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

📋 Pull Request Information

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

Base: main ← Head: fix/lan-guest-containers


📝 Commits (9)

  • dac18e8 LAN: mobs target and attack guests
  • 327aa5a tools/lan_e2e.py: a world with commands, so the guest's commands run again
  • 600bae5 LAN guest: hurt by lava, fire, drowning, suffocation and the void; hungry from moving
  • 2e12123 tools/lan_e2e.py: hazards counts the food spent from full health
  • 36d7f02 LAN: PvP between the host and guests
  • e289980 LAN guest: their own ender chest, and double chests as 9x6
  • 64f7ecd tools/lan_e2e.py: containers takes its chests away
  • 257b5e9 tools/lan_e2e.py: containers waits for the server's menu before reading or taking
  • bc0cd9c LAN guest: a use packet uses the item alone

📊 Changes

16 files changed (+1041 additions, -116 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+68 -43)
📝 crates/horizon-client/src/game/creatures.rs (+74 -9)
📝 crates/horizon-client/src/game/hand.rs (+1 -0)
📝 crates/horizon-client/src/game/lan.rs (+10 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+132 -28)
➕ crates/horizon-client/src/game/lan_mobs.rs (+264 -0)
➕ crates/horizon-client/src/game/lan_pvp.rs (+110 -0)
📝 crates/horizon-client/src/game/remote.rs (+41 -1)
📝 crates/horizon-client/src/game/storage.rs (+7 -1)
📝 crates/horizon-client/src/lan/containers.rs (+26 -27)
📝 crates/horizon-client/src/lan/guest.rs (+6 -0)
📝 crates/horizon-client/src/lan/hub.rs (+3 -0)
📝 crates/horizon-client/src/lan/menu.rs (+72 -1)
📝 crates/horizon-client/src/lan/playerdata.rs (+6 -1)
📝 crates/horizon-client/src/motion/environment.rs (+21 -1)
📝 tools/lan_e2e.py (+200 -4)

📄 Description

Part of #435 (items: a guest's ender chest opens the host's ender inventory; double chests open as 9×3). Stacked on #470: merge #466, #467, #470, then this.

What vanilla does

  • EnderChestBlock.useWithoutItem opens a generic_9x3 menu titled container.enderchest over the player's own PlayerEnderChestContainer (saved as EnderItems in their player data).
  • ChestBlock.getMenuProvider combines the two halves of a double chest into a CompoundContainer (the RIGHT-type half first) behind a generic_9x6 menu titled container.chestDouble.
  • The client draws a chest-like menu with the rows of its MenuType and the title the server sent.

What this changes

  • Host side: a guest's container menu says where its slots live (lan::menu::Slots: one block entity, a double chest, or the guest's ender inventory). Reads, clicks and change sync go through it. Guest.ender_items is loaded from and saved to the guest's player data. as_guest swaps the ender inventories, so a guest never sees the host's, and an ender chest the host has open stays the host's while a guest acts.
  • Client side (a Horizon guest of any server): the menu's stand-in slots go on the clicked block only when that block holds that container; otherwise the block update that follows deleted them (ender chest) or the other half added 27 slots (double chest). Chest-like server menus take their rows and title from the server.

How it was verified

  • Two real clients on this Mac (host + guest, offscreen): new containers check in tools/lan_e2e.py. The host's ender chest holds a diamond, the guest's an emerald. The guest's ender chest shows only the emerald (27 slots) and the host's EnderItems stays diamond only. A left+right chest pair opens as 54 slots with the right half's gold in slot 0 and the left half's iron in slot 27. Shift-clicking the emerald and the gold out moves them to the guest's inventory, and reopening shows them gone. Screenshots: "Ender Chest" with the emerald; "Large Chest", 6 rows. chest still passes.
  • fmt, cargo clippy -p horizon-client --all-targets -- -D warnings. Parity harnesses: one tools/parity.py --changed origin/main run on the branch combining this series (results on the last PR).

Follow-up (after a full 14-check run on the combined stack)

  • Fix: a guest's ServerboundUseItemPacket now uses the held item alone, with the packet's rotation (handleUseItem). The host used to run the whole right click against the block the guest had last looked at.
    • The guest client sends UseItem after UseItemOn, so a guest that turned from an ender chest to a double chest could get the ender chest opened again.
    • Seen in about 2 of 7 full e2e runs. Temporary logging showed two opens for one UseItemOn.
  • Harness:
    • open_container waits for the server's menu (and, before a take, the item).
    • containers removes its chests at the end.
  • Still open: after a passing UseItemOn, the host's block-use path falls through to the item, and the following UseItem uses it again. Vanilla's handleUseItemOn never uses the item. Splitting use_hand into block and item halves 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/471 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/lan-guest-containers` --- ### 📝 Commits (9) - [`dac18e8`](https://github.com/horizon-rust/horizon/commit/dac18e8350600d38c4c6b95d987d4738b802185f) LAN: mobs target and attack guests - [`327aa5a`](https://github.com/horizon-rust/horizon/commit/327aa5af6e710b1aa0e3e10652ce0453943b6710) tools/lan_e2e.py: a world with commands, so the guest's commands run again - [`600bae5`](https://github.com/horizon-rust/horizon/commit/600bae5703d222c7b1bd3c51ee8e72b3be12557e) LAN guest: hurt by lava, fire, drowning, suffocation and the void; hungry from moving - [`2e12123`](https://github.com/horizon-rust/horizon/commit/2e1212346f411c06657dec6a68b35ea853430502) tools/lan_e2e.py: hazards counts the food spent from full health - [`36d7f02`](https://github.com/horizon-rust/horizon/commit/36d7f02802889397f0d3c1d71fffbd15a2025f54) LAN: PvP between the host and guests - [`e289980`](https://github.com/horizon-rust/horizon/commit/e289980c1ea486228c73d1b007f522c387cf4c28) LAN guest: their own ender chest, and double chests as 9x6 - [`64f7ecd`](https://github.com/horizon-rust/horizon/commit/64f7ecd3671cfa13a044f68c048885c02a34f021) tools/lan_e2e.py: containers takes its chests away - [`257b5e9`](https://github.com/horizon-rust/horizon/commit/257b5e9f2d76c3d39e84a13754b2363d846cb8e9) tools/lan_e2e.py: containers waits for the server's menu before reading or taking - [`bc0cd9c`](https://github.com/horizon-rust/horizon/commit/bc0cd9cc844853472e83c780e07ec3db2cbde7ad) LAN guest: a use packet uses the item alone ### 📊 Changes **16 files changed** (+1041 additions, -116 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+68 -43) 📝 `crates/horizon-client/src/game/creatures.rs` (+74 -9) 📝 `crates/horizon-client/src/game/hand.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+10 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+132 -28) ➕ `crates/horizon-client/src/game/lan_mobs.rs` (+264 -0) ➕ `crates/horizon-client/src/game/lan_pvp.rs` (+110 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+41 -1) 📝 `crates/horizon-client/src/game/storage.rs` (+7 -1) 📝 `crates/horizon-client/src/lan/containers.rs` (+26 -27) 📝 `crates/horizon-client/src/lan/guest.rs` (+6 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+3 -0) 📝 `crates/horizon-client/src/lan/menu.rs` (+72 -1) 📝 `crates/horizon-client/src/lan/playerdata.rs` (+6 -1) 📝 `crates/horizon-client/src/motion/environment.rs` (+21 -1) 📝 `tools/lan_e2e.py` (+200 -4) </details> ### 📄 Description Part of #435 (items: a guest's ender chest opens the host's ender inventory; double chests open as 9×3). Stacked on #470: merge #466, #467, #470, then this. ## What vanilla does - `EnderChestBlock.useWithoutItem` opens a `generic_9x3` menu titled `container.enderchest` over the player's own `PlayerEnderChestContainer` (saved as `EnderItems` in their player data). - `ChestBlock.getMenuProvider` combines the two halves of a double chest into a `CompoundContainer` (the RIGHT-type half first) behind a `generic_9x6` menu titled `container.chestDouble`. - The client draws a chest-like menu with the rows of its `MenuType` and the title the server sent. ## What this changes - Host side: a guest's container menu says where its slots live (`lan::menu::Slots`: one block entity, a double chest, or the guest's ender inventory). Reads, clicks and change sync go through it. `Guest.ender_items` is loaded from and saved to the guest's player data. `as_guest` swaps the ender inventories, so a guest never sees the host's, and an ender chest the host has open stays the host's while a guest acts. - Client side (a Horizon guest of any server): the menu's stand-in slots go on the clicked block only when that block holds that container; otherwise the block update that follows deleted them (ender chest) or the other half added 27 slots (double chest). Chest-like server menus take their rows and title from the server. ## How it was verified - **Two real clients on this Mac** (host + guest, offscreen): new `containers` check in `tools/lan_e2e.py`. The host's ender chest holds a diamond, the guest's an emerald. The guest's ender chest shows only the emerald (27 slots) and the host's `EnderItems` stays diamond only. A left+right chest pair opens as 54 slots with the right half's gold in slot 0 and the left half's iron in slot 27. Shift-clicking the emerald and the gold out moves them to the guest's inventory, and reopening shows them gone. Screenshots: "Ender Chest" with the emerald; "Large Chest", 6 rows. `chest` still passes. - fmt, `cargo clippy -p horizon-client --all-targets -- -D warnings`. Parity harnesses: one `tools/parity.py --changed origin/main` run on the branch combining this series (results on the last PR). ## Follow-up (after a full 14-check run on the combined stack) - **Fix:** a guest's `ServerboundUseItemPacket` now uses the held item alone, with the packet's rotation (`handleUseItem`). The host used to run the whole right click against the block the guest had last looked at. - The guest client sends `UseItem` after `UseItemOn`, so a guest that turned from an ender chest to a double chest could get the ender chest opened again. - Seen in about 2 of 7 full e2e runs. Temporary logging showed two `open`s for one `UseItemOn`. - **Harness:** - `open_container` waits for the server's menu (and, before a take, the item). - `containers` removes its chests at the end. - **Still open:** after a passing `UseItemOn`, the host's block-use path falls through to the item, and the following `UseItem` uses it again. Vanilla's `handleUseItemOn` never uses the item. Splitting `use_hand` into block and item halves 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-02 15:57:25 +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#2586
No description provided.