[PR #429] [MERGED] LAN guest: crafting in the 2x2 grid and at a crafting table #2560

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

📋 Pull Request Information

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

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


📝 Commits (3)

  • 4718fef LAN: chest lids open and close for every player
  • 8d6b8b3 LAN: a trading screen a guest opens releases the chest it replaces
  • 227edf7 LAN guest: crafting in the inventory grid and at a crafting table

📊 Changes

10 files changed (+457 additions, -26 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+5 -0)
📝 crates/horizon-client/src/game/agent.rs (+10 -3)
📝 crates/horizon-client/src/game/block_entity_anims.rs (+29 -9)
📝 crates/horizon-client/src/game/lan.rs (+8 -1)
📝 crates/horizon-client/src/game/lan_actions.rs (+53 -8)
➕ crates/horizon-client/src/game/lan_crafting.rs (+287 -0)
📝 crates/horizon-client/src/game/lan_trading.rs (+2 -0)
📝 crates/horizon-client/src/game/remote.rs (+17 -0)
📝 crates/horizon-client/src/lan/containers.rs (+36 -4)
📝 crates/horizon-client/src/lan/guest.rs (+10 -1)

📄 Description

What

A LAN guest can craft: in the inventory's 2x2 grid and at a crafting table (3x3), with shift-click, drag and the result taken like in single player. The grid goes back into the inventory, or is dropped when the inventory is full, when the menu closes or the guest leaves.

Stacked on #427 (the chest lids PR): opening a crafting table releases the container it replaces.

Why

The host's hub only served container windows. A guest's click on window 0 (the inventory menu, where the 2x2 grid lives) was ignored, and a crafting table opened no window at all. Vanilla runs InventoryMenu and CraftingMenu on the server and returns the grid with AbstractContainerMenu.clearContainer when the menu is removed.

How

game/lan_crafting.rs runs Horizon's vanilla-checked menu engine (horizon_client::menu::Menu, Kind::Inventory and Kind::Crafting) over the guest's inventory, armour, off hand and carried stack:

  • Window-0 clicks go through the inventory menu, and the hub answers with vanilla's slot corrections (inventory_clicked).
  • A crafting table opens a minecraft:crafting window (open_window, shared with the trading screen). Its clicks run the crafting menu and resend the content.
  • On close or leave, the grid returns to the inventory and what doesn't fit is dropped (lan_crafting_closed / lan_crafting_left).
    The guest keeps his own craft_grid/craft_result; as_guest swaps the host's 2x2/3x3 grid state while it runs.

How tested

Two-client test (tools/lan_e2e.py, its own PR, #424): a host and a guest, both real games offscreen on the Mac mini, the guest joining over 127.0.0.1. Each check is reported on its own, with screenshots of both sides.

check origin/main this branch alone all six fixes merged
crafting FAIL (0 planks) PASS (4 planks; 4 sticks at a table) PASS

Screenshots, before and after, both sides: ~/code/horizon-parity/shots/lan/ (before-*, *-after-*, after-all-*).

Self-check on the integration commit (origin/main + the six LAN fixes):

cargo fmt --all --check                                       clean
cargo clippy --workspace --all-targets -- -D warnings         clean (exit 0)
cargo test -p horizon-client                                  743 passed, 0 failed
tools/parity.py --changed origin/main                         81 harnesses depend on the change: 81 passed, 0 failed

What needs Ludovic

  • Nothing to decide. Not tested: two physical machines (every run was host and guest on one Mac over loopback).

Fixes #366 (one of six PRs; merge order: self-model, armour, chest lids, name tags, crafting, damage, then the test).

🤖 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/429 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/lan-guest-crafting` --- ### 📝 Commits (3) - [`4718fef`](https://github.com/horizon-rust/horizon/commit/4718fef2ab7b5607fa471731f0264bba83c6c991) LAN: chest lids open and close for every player - [`8d6b8b3`](https://github.com/horizon-rust/horizon/commit/8d6b8b3f03d3b5f828da3e7df5402de8d2466fd2) LAN: a trading screen a guest opens releases the chest it replaces - [`227edf7`](https://github.com/horizon-rust/horizon/commit/227edf7517db453f4ed9620a984535031407b14e) LAN guest: crafting in the inventory grid and at a crafting table ### 📊 Changes **10 files changed** (+457 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+5 -0) 📝 `crates/horizon-client/src/game/agent.rs` (+10 -3) 📝 `crates/horizon-client/src/game/block_entity_anims.rs` (+29 -9) 📝 `crates/horizon-client/src/game/lan.rs` (+8 -1) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+53 -8) ➕ `crates/horizon-client/src/game/lan_crafting.rs` (+287 -0) 📝 `crates/horizon-client/src/game/lan_trading.rs` (+2 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+17 -0) 📝 `crates/horizon-client/src/lan/containers.rs` (+36 -4) 📝 `crates/horizon-client/src/lan/guest.rs` (+10 -1) </details> ### 📄 Description ## What A LAN guest can craft: in the inventory's 2x2 grid and at a crafting table (3x3), with shift-click, drag and the result taken like in single player. The grid goes back into the inventory, or is dropped when the inventory is full, when the menu closes or the guest leaves. **Stacked on #427** (the chest lids PR): opening a crafting table releases the container it replaces. ## Why The host's hub only served container windows. A guest's click on window 0 (the inventory menu, where the 2x2 grid lives) was ignored, and a crafting table opened no window at all. Vanilla runs `InventoryMenu` and `CraftingMenu` on the server and returns the grid with `AbstractContainerMenu.clearContainer` when the menu is removed. ## How `game/lan_crafting.rs` runs Horizon's vanilla-checked menu engine (`horizon_client::menu::Menu`, `Kind::Inventory` and `Kind::Crafting`) over the guest's inventory, armour, off hand and carried stack: - Window-0 clicks go through the inventory menu, and the hub answers with vanilla's slot corrections (`inventory_clicked`). - A crafting table opens a `minecraft:crafting` window (`open_window`, shared with the trading screen). Its clicks run the crafting menu and resend the content. - On close or leave, the grid returns to the inventory and what doesn't fit is dropped (`lan_crafting_closed` / `lan_crafting_left`). The guest keeps his own `craft_grid`/`craft_result`; `as_guest` swaps the host's 2x2/3x3 grid state while it runs. ## How tested **Two-client test** (`tools/lan_e2e.py`, its own PR, #424): a host and a guest, both real games offscreen on the Mac mini, the guest joining over `127.0.0.1`. Each check is reported on its own, with screenshots of both sides. | check | origin/main | this branch alone | all six fixes merged | |---|---|---|---| | crafting | FAIL (0 planks) | PASS (4 planks; 4 sticks at a table) | PASS | Screenshots, before and after, both sides: `~/code/horizon-parity/shots/lan/` (`before-*`, `*-after-*`, `after-all-*`). **Self-check** on the integration commit (origin/main + the six LAN fixes): ``` cargo fmt --all --check clean cargo clippy --workspace --all-targets -- -D warnings clean (exit 0) cargo test -p horizon-client 743 passed, 0 failed tools/parity.py --changed origin/main 81 harnesses depend on the change: 81 passed, 0 failed ``` ## What needs Ludovic - Nothing to decide. Not tested: two physical machines (every run was host and guest on one Mac over loopback). Fixes #366 (one of six PRs; merge order: self-model, armour, chest lids, name tags, crafting, damage, then the test). 🤖 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: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#2560
No description provided.