[PR #1188] [MERGED] LAN guests: the lectern and the cartography table (#868) #3402

Closed
opened 2026-11-03 04:09:16 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/lan-guest-workstations-8


📝 Commits (9)

  • cd37ea9 LAN guests use looms: workstation menus on the host's menu engine
  • c8f02d9 Stonecutter on the menu engine; LAN guests use stonecutters
  • 4fecf43 Grindstone on the menu engine; LAN guests use grindstones
  • 3e86868 Anvil and smithing table on the menu engine; LAN guests use them
  • b5a9226 Enchanting table on the menu engine; LAN guests enchant
  • ca5404e Beacon on the menu engine; LAN guests use beacons
  • dbb1ca0 LAN guests use crafters
  • de8cb0d LAN guests: the lectern and the cartography table (#868)
  • 8859d7a Merge origin/main into fix/lan-guest-workstations-8 (tools/lan_e2e.py: keep both sides' checks)

📊 Changes

34 files changed (+3827 additions, -584 deletions)

View changed files

📝 crates/horizon-client/examples/cauldron_fixture.rs (+7 -0)
📝 crates/horizon-client/examples/menu_fixture.rs (+106 -4)
📝 crates/horizon-client/examples/place_recipe_fixture.rs (+7 -0)
📝 crates/horizon-client/examples/trading_fixture.rs (+6 -0)
📝 crates/horizon-client/src/creative.rs (+1 -0)
📝 crates/horizon-client/src/enchant.rs (+1 -0)
📝 crates/horizon-client/src/game.rs (+150 -7)
📝 crates/horizon-client/src/game/beacon.rs (+16 -6)
📝 crates/horizon-client/src/game/books.rs (+204 -37)
📝 crates/horizon-client/src/game/cartography.rs (+68 -58)
📝 crates/horizon-client/src/game/control.rs (+10 -1)
📝 crates/horizon-client/src/game/lan_actions.rs (+37 -2)
📝 crates/horizon-client/src/game/lan_crafting.rs (+99 -11)
➕ crates/horizon-client/src/game/lan_stations.rs (+672 -0)
📝 crates/horizon-client/src/game/lan_trading.rs (+10 -3)
📝 crates/horizon-client/src/game/loom.rs (+4 -2)
📝 crates/horizon-client/src/game/machines/crafter.rs (+10 -0)
📝 crates/horizon-client/src/game/recipe_book.rs (+4 -0)
📝 crates/horizon-client/src/game/remote.rs (+140 -11)
➕ crates/horizon-client/src/game/remote_stations.rs (+156 -0)

...and 14 more files

📄 Description

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

Fixes #868

What

LAN guests can now use the last two workstation menus, the lectern and the cartography table. Both run on the shared menu engine (horizon_client::menu), which single player uses too.

  • Lectern (Kind::Lectern, LecternMenu):
    • The page arrows (buttons 1 and 2, and 100+ to jump to a page) and Take Book (button 3, only when the player mayBuild) are ContainerButtonClicks.
    • The page is data slot 0, clamped to the book's pages. The book sits in the menu's one slot: removeItem empties the lectern, setItem does nothing, the slot holds at most 1.
    • For a guest, the host opens minecraft:lectern, applies the menu to the block entity (the powered pulse, level event 1043 for the page sound, has_book) and resends what changed. It closes the menu when stillValid fails: the book is gone or the guest is out of reach.
    • The guest drives it from its book screen.
    • Single player now goes through the same menu (Take Book, the page buttons). It also counts interact_with_lectern.
  • Cartography table (Kind::Cartography, CartographyTableMenu):
    • Covers setupResultSlot (extend with paper, lock with a glass pane, clone with an empty map), quickMoveStack, and onTake with its sound.
    • Taking a result runs onCraftedBy: a new map id for an extended or locked map, through a new Maps env that Game::level_maps / register_made_maps back.
    • It replaces the old cartography station code (station_click now always goes to the engine).
  • LAN item stacks now carry map_post_processing (50) and the contents of writable and written books (56, 57). Before this, a guest saw blank books. map_post_processing is no longer written to saves: vanilla's ItemStack.CODEC never saves it.
  • A guest who enchants now gets the enchant_item stat (EnchantmentMenu's awardStat).

Why

These two were what was left of #868 after #1165-#1170 and #1172. Thanks to @Tydragon00, who reported it in #848 (which #868 was split from).

Stack (merge in this order): #1165 loom → #1166 stonecutter → #1167 grindstone → #1168 anvil + smithing table → #1169 enchanting table → #1170 beacon → #1172 crafter → this PR. Its base is fix/lan-guest-workstations-7, so the diff shows only the lectern and cartography work.

How tested

Everything ran on the desktop, on this branch's tip.

cargo fmt --all -- --check                                   clean
set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings   clean (exit 0)
cargo test -p horizon-client -p horizon-protocol             0 failed (horizon-client 984 lib + 91 bin + 15 ctl
                                                             + 7 integration; horizon-protocol 64, incl. book and
                                                             map_post_processing round trips)
tools/test_menu_click_parity.py (all menus, seed 7)          8000/8000 cases match
tools/test_menu_click_parity.py --menus cartography,lectern --seed 11 --cases 4000
                                                             4000/4000 match (3000/3000 on seed 7 while porting)
tools/lan_e2e.py, in-frame and --server-thread, each:        15/15 PASS
  loom stonecutter grindstone anvil smithing enchanting beacon crafter lectern cartography
  machines containers clicks chest crafting
single player (the same checks on a solo world under horizon-ctl)
  lectern cartography enchanting grindstone stonecutter loom anvil smithing beacon   PASS
tools/parity.py --changed origin/main                        102/102 PASS (99 in the full run; save_roundtrip,
                                                             world_reopen and secure_chat failed only because the
                                                             run had no display libraries, and pass rerun with them)

The new lan_e2e checks:

  • lectern: the guest opens a lectern holding a 3-page written book. It turns forward three times (clamped at the last page) and back once. The server's Page is 1. Then Take Book: the screen closes, the server has the book in the guest's inventory, and the lectern has has_book=false.
  • cartography: the host makes a map, and the guest shift-clicks a copy of it and paper into the table and takes the zoomed-out result. The server has a new map id and no paper left.
  • enchanting now also checks the guest's enchant_item stat through a scoreboard objective.

Harness fixes found along the way:

  • With --server-thread, a guest gets its own command's [Guest: ...] operator broadcast back, a moment later. server_count took one of those for the next command's answer, so they now ignore these lines. The bug itself is noted in the parity LATER list.
  • The grindstone check now counts levels as well as points, because 16 points make exactly two levels and leave 0 points.

Known gaps (also in the parity FEATURES.md LATER list, 4p)

  • LAN sends no map data (ClientboundMapItemData). A guest's maps and cartography previews draw blank, but the server's maps are right.
  • The engine's lectern doesn't model vanilla's stack aliasing: a SWAP, or a PICKUP that swaps, on the book slot hands the block entity's own stack around. The click-parity fuzz sticks to buttons and simple clicks for the lectern.
  • Guest stacks lack banner_patterns and trim, so a guest's loom and smithing previews show plain items. The server's results are right.
  • The enchanted_item advancement criterion is never triggered, in single player as well.
  • The host doesn't send the crafter's result slot (45).

What needs Ludovic

Nothing to set up. When the stack is in, a LAN session on two machines is a good extra check: a guest reading a lectern and zooming out a map.

🤖 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/1188 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/lan-guest-workstations-8` --- ### 📝 Commits (9) - [`cd37ea9`](https://github.com/horizon-rust/horizon/commit/cd37ea98a0e85d93263b58bc18e231f39198b146) LAN guests use looms: workstation menus on the host's menu engine - [`c8f02d9`](https://github.com/horizon-rust/horizon/commit/c8f02d91b782c407266e60beb3eb5f4b6664f0fb) Stonecutter on the menu engine; LAN guests use stonecutters - [`4fecf43`](https://github.com/horizon-rust/horizon/commit/4fecf43d28c4ff4a85699db7cee93af00c7fdd39) Grindstone on the menu engine; LAN guests use grindstones - [`3e86868`](https://github.com/horizon-rust/horizon/commit/3e868683bae129f0875b030507d3bc77d809673e) Anvil and smithing table on the menu engine; LAN guests use them - [`b5a9226`](https://github.com/horizon-rust/horizon/commit/b5a92262c8cc69bb5e5d783694ad327878a30f5b) Enchanting table on the menu engine; LAN guests enchant - [`ca5404e`](https://github.com/horizon-rust/horizon/commit/ca5404e52dcdf4c2cfcff16876e84946fba5bf79) Beacon on the menu engine; LAN guests use beacons - [`dbb1ca0`](https://github.com/horizon-rust/horizon/commit/dbb1ca0907cc6b4c1863ecf9d5eb398dea6d9f31) LAN guests use crafters - [`de8cb0d`](https://github.com/horizon-rust/horizon/commit/de8cb0dfa6991c847715722e0c0b5a08467aa345) LAN guests: the lectern and the cartography table (#868) - [`8859d7a`](https://github.com/horizon-rust/horizon/commit/8859d7a3a3057bb8904c6b89236c0bd9cab21cc0) Merge origin/main into fix/lan-guest-workstations-8 (tools/lan_e2e.py: keep both sides' checks) ### 📊 Changes **34 files changed** (+3827 additions, -584 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/cauldron_fixture.rs` (+7 -0) 📝 `crates/horizon-client/examples/menu_fixture.rs` (+106 -4) 📝 `crates/horizon-client/examples/place_recipe_fixture.rs` (+7 -0) 📝 `crates/horizon-client/examples/trading_fixture.rs` (+6 -0) 📝 `crates/horizon-client/src/creative.rs` (+1 -0) 📝 `crates/horizon-client/src/enchant.rs` (+1 -0) 📝 `crates/horizon-client/src/game.rs` (+150 -7) 📝 `crates/horizon-client/src/game/beacon.rs` (+16 -6) 📝 `crates/horizon-client/src/game/books.rs` (+204 -37) 📝 `crates/horizon-client/src/game/cartography.rs` (+68 -58) 📝 `crates/horizon-client/src/game/control.rs` (+10 -1) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+37 -2) 📝 `crates/horizon-client/src/game/lan_crafting.rs` (+99 -11) ➕ `crates/horizon-client/src/game/lan_stations.rs` (+672 -0) 📝 `crates/horizon-client/src/game/lan_trading.rs` (+10 -3) 📝 `crates/horizon-client/src/game/loom.rs` (+4 -2) 📝 `crates/horizon-client/src/game/machines/crafter.rs` (+10 -0) 📝 `crates/horizon-client/src/game/recipe_book.rs` (+4 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+140 -11) ➕ `crates/horizon-client/src/game/remote_stations.rs` (+156 -0) _...and 14 more files_ </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #868 ## What LAN guests can now use the last two workstation menus, the **lectern** and the **cartography table**. Both run on the shared menu engine (`horizon_client::menu`), which single player uses too. - **Lectern** (`Kind::Lectern`, `LecternMenu`): - The page arrows (buttons 1 and 2, and 100+ to jump to a page) and **Take Book** (button 3, only when the player `mayBuild`) are `ContainerButtonClick`s. - The page is data slot 0, clamped to the book's pages. The book sits in the menu's one slot: `removeItem` empties the lectern, `setItem` does nothing, the slot holds at most 1. - For a guest, the host opens `minecraft:lectern`, applies the menu to the block entity (the powered pulse, level event 1043 for the page sound, `has_book`) and resends what changed. It closes the menu when `stillValid` fails: the book is gone or the guest is out of reach. - The guest drives it from its book screen. - Single player now goes through the same menu (Take Book, the page buttons). It also counts `interact_with_lectern`. - **Cartography table** (`Kind::Cartography`, `CartographyTableMenu`): - Covers `setupResultSlot` (extend with paper, lock with a glass pane, clone with an empty map), `quickMoveStack`, and `onTake` with its sound. - Taking a result runs `onCraftedBy`: a new map id for an extended or locked map, through a new `Maps` env that `Game::level_maps` / `register_made_maps` back. - It replaces the old cartography station code (`station_click` now always goes to the engine). - **LAN item stacks** now carry `map_post_processing` (50) and the contents of writable and written books (56, 57). Before this, a guest saw blank books. `map_post_processing` is no longer written to saves: vanilla's `ItemStack.CODEC` never saves it. - A guest who enchants now gets the `enchant_item` stat (EnchantmentMenu's `awardStat`). ## Why These two were what was left of #868 after #1165-#1170 and #1172. Thanks to **@Tydragon00**, who reported it in #848 (which #868 was split from). **Stack (merge in this order):** #1165 loom → #1166 stonecutter → #1167 grindstone → #1168 anvil + smithing table → #1169 enchanting table → #1170 beacon → #1172 crafter → this PR. Its base is `fix/lan-guest-workstations-7`, so the diff shows only the lectern and cartography work. ## How tested Everything ran on the desktop, on this branch's tip. ``` cargo fmt --all -- --check clean set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings clean (exit 0) cargo test -p horizon-client -p horizon-protocol 0 failed (horizon-client 984 lib + 91 bin + 15 ctl + 7 integration; horizon-protocol 64, incl. book and map_post_processing round trips) tools/test_menu_click_parity.py (all menus, seed 7) 8000/8000 cases match tools/test_menu_click_parity.py --menus cartography,lectern --seed 11 --cases 4000 4000/4000 match (3000/3000 on seed 7 while porting) tools/lan_e2e.py, in-frame and --server-thread, each: 15/15 PASS loom stonecutter grindstone anvil smithing enchanting beacon crafter lectern cartography machines containers clicks chest crafting single player (the same checks on a solo world under horizon-ctl) lectern cartography enchanting grindstone stonecutter loom anvil smithing beacon PASS tools/parity.py --changed origin/main 102/102 PASS (99 in the full run; save_roundtrip, world_reopen and secure_chat failed only because the run had no display libraries, and pass rerun with them) ``` The new lan_e2e checks: - **lectern:** the guest opens a lectern holding a 3-page written book. It turns forward three times (clamped at the last page) and back once. The server's `Page` is 1. Then Take Book: the screen closes, the server has the book in the guest's inventory, and the lectern has `has_book=false`. - **cartography:** the host makes a map, and the guest shift-clicks a copy of it and paper into the table and takes the zoomed-out result. The server has a new map id and no paper left. - **enchanting** now also checks the guest's `enchant_item` stat through a scoreboard objective. Harness fixes found along the way: - With `--server-thread`, a guest gets its own command's `[Guest: ...]` operator broadcast back, a moment later. `server_count` took one of those for the next command's answer, so they now ignore these lines. The bug itself is noted in the parity LATER list. - The grindstone check now counts levels as well as points, because 16 points make exactly two levels and leave 0 points. ### Known gaps (also in the parity FEATURES.md LATER list, 4p) - LAN sends no map data (`ClientboundMapItemData`). A guest's maps and cartography previews draw blank, but the server's maps are right. - The engine's lectern doesn't model vanilla's stack aliasing: a SWAP, or a PICKUP that swaps, on the book slot hands the block entity's own stack around. The click-parity fuzz sticks to buttons and simple clicks for the lectern. - Guest stacks lack `banner_patterns` and `trim`, so a guest's loom and smithing previews show plain items. The server's results are right. - The `enchanted_item` advancement criterion is never triggered, in single player as well. - The host doesn't send the crafter's result slot (45). ## What needs Ludovic Nothing to set up. When the stack is in, a LAN session on two machines is a good extra check: a guest reading a lectern and zooming out a map. 🤖 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-03 04:09:16 +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#3402
No description provided.