[PR #714] [MERGED] Show the server's recipe book on a server and place its recipes #2752

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

📋 Pull Request Information

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

Base: main ← Head: feat/remote-recipe-book


📝 Commits (8)

📊 Changes

24 files changed (+1615 additions, -167 deletions)

View changed files

📝 crates/horizon-client/src/command/mod.rs (+1 -0)
➕ crates/horizon-client/src/command/network.rs (+404 -0)
📝 crates/horizon-client/src/game.rs (+1 -8)
📝 crates/horizon-client/src/game/agent.rs (+12 -0)
📝 crates/horizon-client/src/game/chat.rs (+27 -6)
📝 crates/horizon-client/src/game/control.rs (+0 -12)
📝 crates/horizon-client/src/game/debug_keys.rs (+1 -2)
📝 crates/horizon-client/src/game/lan_actions.rs (+1 -0)
📝 crates/horizon-client/src/game/lan_crafting.rs (+80 -0)
📝 crates/horizon-client/src/game/pad.rs (+0 -7)
📝 crates/horizon-client/src/game/pad_menu.rs (+7 -11)
📝 crates/horizon-client/src/game/recipe_book.rs (+122 -1)
📝 crates/horizon-client/src/game/remote.rs (+37 -105)
📝 crates/horizon-client/src/game/scoreboard.rs (+0 -2)
📝 crates/horizon-client/src/lan/advancements.rs (+14 -0)
📝 crates/horizon-client/src/lan/hub.rs (+14 -0)
📝 crates/horizon-client/src/recipe_book.rs (+9 -0)
📝 crates/horizon-client/tests/lan_bot.rs (+1 -3)
📝 crates/horizon-protocol/src/buf.rs (+4 -0)
📝 crates/horizon-protocol/src/packets/mod.rs (+1 -0)

...and 4 more files

📄 Description

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

Task 5 of the server-thread work. It is stacked on #708 (the command tree), because both replace parts of the remote client and the harness, so it targets feat/server-command-tree. It retargets to main once #708 merges.

Problem

On a server, including single player's integrated server thread, the inventory had no recipe book:

  • the window ignored RecipeBookAdd / RecipeBookRemove / RecipeBookSettings (their recipe displays were not decoded) and active_book() returned nothing on a server;
  • the server ignored a player's ServerboundPlaceRecipePacket, so even a vanilla client could not place recipes on a Horizon LAN or server.

Change

  • horizon-protocol packets::recipes decodes and encodes the recipe book packets:

    • RecipeBookAdd (RecipeDisplayEntry plus flags), RecipeBookRemove, RecipeBookSettings, PlaceGhostRecipe and the serverbound PlaceRecipe;
    • every 26.3 minecraft:recipe_display type: shapeless, shaped, furnace, stonecutter and smithing;
    • every minecraft:slot_display type: empty, any_fuel, with_any_potion, only_with_component, item, item_stack (ItemStackTemplate), tag (holder sets by tag or ids), dyed, smithing_trim (trim pattern by id or inline), with_remainder and composite, with a nesting limit.
  • Client, on a server (ClientRecipeBook):

    • The book holds the displays the server sent: added, highlighted when new, removed, or replaced on the initial batch.
    • Entries with the notification flag show the "New Recipe(s) Unlocked" toast.
    • The settings packet opens or filters each book.
    • The craftable filter counts the slots the server last sent.
    • Clicking a recipe sends PlaceRecipe for the open window (0 for the inventory). A PlaceGhostRecipe answer fades the recipe into the grid.

    Display ids map to the client's book entries through the same RecipeManager numbering the server uses.

  • Server (lan_place_recipe, handlePlaceRecipe):

    • A guest's PlaceRecipe places a recipe the guest knows, and that is not impossible, in their inventory grid or open crafting table with the menu engine's ServerPlaceRecipe.
    • It answers with the menu's slots, or with PlaceGhostRecipe when the items are missing.
  • The screen state reports the recipe book's buttons, for harnesses.

Not in this PR:

  • The server sends only crafting recipes in the book (this was already the case), so the furnace books stay empty on a Horizon server, and furnace placement is not handled server-side.
  • The client does not send RecipeBookSeenRecipe / RecipeBookChangeSettings, and the server does not handle them yet.

Tests

  • Protocol: a round trip of a book with a shaped entry and a smithing entry that nests every slot display kind.
  • tools/lan_e2e.py --check recipes (new). The guest gets 4 oak logs, opens the inventory and the book, and clicks the planks recipe:
    • before (the #700 stack build, without this change): FAIL, the guest's inventory has no recipe book;
    • after: PASS, {'known': 3, 'grid': {100: 'minecraft:oak_log'}}. The screenshot shows the toast, and the craftable recipes are drawn as craftable.
  • --check crafting --check chest still pass.
  • cargo fmt --all --check: ok.
  • cargo clippy --workspace --all-targets -- -D warnings: ok.
  • cargo test -p horizon-client --lib: 821 passed.
  • cargo test -p horizon-protocol: 56 passed.
  • Local parity: one integration run covers #697, #700, #708 and this PR. The pass count follows in a comment.

Block-break progress (reported, not changed)

The window does not handle ClientboundBlockDestructionPacket, so other players' cracks are not drawn. The renderer draws a single crumbling overlay whose stage comes from a frame uniform (crumbling_sprite in gfx.rs / entity.wgsl). Showing several blocks at different stages needs that atlas rect per vertex in breaking::geometry. That change is in perf-gpu's area, and is reported to the orchestrator.

🤖 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/714 **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:** `feat/remote-recipe-book` --- ### 📝 Commits (8) - [`e4741b7`](https://github.com/horizon-rust/horizon/commit/e4741b7793211787741f520d9667cebfd9aaeca8) Decode the server's command tree and complete commands with it - [`a4feb65`](https://github.com/horizon-rust/horizon/commit/a4feb6516102eaffb9e82437f808e32f4d05bde0) Show the server's recipe book on a server and place its recipes - [`7c5bd06`](https://github.com/horizon-rust/horizon/commit/7c5bd06dfe7018793e2db3260b5a887d910e6a27) lan_bot: the command tree arrives parsed (#708) - [`b5abc95`](https://github.com/horizon-rust/horizon/commit/b5abc95fe4f783261cc7b11815f1296f643d9e01) Merge commit 'a4feb6516102eaffb9e82437f808e32f4d05bde0' into HEAD - [`1c79add`](https://github.com/horizon-rust/horizon/commit/1c79addec1520d31da93589016f27a3e9596fe39) Input capture test: on a server the chat is ChatScreen (#708) - [`2025408`](https://github.com/horizon-rust/horizon/commit/2025408979428ebec5a19ad30b28ec43b6e4165c) Merge commit 'b5abc95f' into HEAD - [`bf1cd95`](https://github.com/horizon-rust/horizon/commit/bf1cd958686ffc95a6ff30cdbedc9a8de59315ad) Merge main into feat/server-command-tree - [`8bfe192`](https://github.com/horizon-rust/horizon/commit/8bfe19245b5a6ae4f7eabb2acbca9e26d374d8d2) Merge commit 'bf1cd958686ffc95a6ff30cdbedc9a8de59315ad' into HEAD ### 📊 Changes **24 files changed** (+1615 additions, -167 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/command/mod.rs` (+1 -0) ➕ `crates/horizon-client/src/command/network.rs` (+404 -0) 📝 `crates/horizon-client/src/game.rs` (+1 -8) 📝 `crates/horizon-client/src/game/agent.rs` (+12 -0) 📝 `crates/horizon-client/src/game/chat.rs` (+27 -6) 📝 `crates/horizon-client/src/game/control.rs` (+0 -12) 📝 `crates/horizon-client/src/game/debug_keys.rs` (+1 -2) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan_crafting.rs` (+80 -0) 📝 `crates/horizon-client/src/game/pad.rs` (+0 -7) 📝 `crates/horizon-client/src/game/pad_menu.rs` (+7 -11) 📝 `crates/horizon-client/src/game/recipe_book.rs` (+122 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+37 -105) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+0 -2) 📝 `crates/horizon-client/src/lan/advancements.rs` (+14 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+14 -0) 📝 `crates/horizon-client/src/recipe_book.rs` (+9 -0) 📝 `crates/horizon-client/tests/lan_bot.rs` (+1 -3) 📝 `crates/horizon-protocol/src/buf.rs` (+4 -0) 📝 `crates/horizon-protocol/src/packets/mod.rs` (+1 -0) _...and 4 more files_ </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Task 5 of the server-thread work. It is stacked on #708 (the command tree), because both replace parts of the remote client and the harness, so it targets `feat/server-command-tree`. It retargets to `main` once #708 merges. ## Problem On a server, including single player's integrated server thread, the inventory had no recipe book: - the window ignored `RecipeBookAdd` / `RecipeBookRemove` / `RecipeBookSettings` (their recipe displays were not decoded) and `active_book()` returned nothing on a server; - the server ignored a player's `ServerboundPlaceRecipePacket`, so even a vanilla client could not place recipes on a Horizon LAN or server. ## Change - **horizon-protocol `packets::recipes`** decodes and encodes the recipe book packets: - `RecipeBookAdd` (`RecipeDisplayEntry` plus flags), `RecipeBookRemove`, `RecipeBookSettings`, `PlaceGhostRecipe` and the serverbound `PlaceRecipe`; - every 26.3 `minecraft:recipe_display` type: shapeless, shaped, furnace, stonecutter and smithing; - every `minecraft:slot_display` type: empty, any_fuel, with_any_potion, only_with_component, item, item_stack (ItemStackTemplate), tag (holder sets by tag or ids), dyed, smithing_trim (trim pattern by id or inline), with_remainder and composite, with a nesting limit. - **Client, on a server** (`ClientRecipeBook`): - The book holds the displays the server sent: added, highlighted when new, removed, or replaced on the initial batch. - Entries with the notification flag show the "New Recipe(s) Unlocked" toast. - The settings packet opens or filters each book. - The craftable filter counts the slots the server last sent. - Clicking a recipe sends `PlaceRecipe` for the open window (0 for the inventory). A `PlaceGhostRecipe` answer fades the recipe into the grid. Display ids map to the client's book entries through the same `RecipeManager` numbering the server uses. - **Server** (`lan_place_recipe`, `handlePlaceRecipe`): - A guest's `PlaceRecipe` places a recipe the guest knows, and that is not impossible, in their inventory grid or open crafting table with the menu engine's `ServerPlaceRecipe`. - It answers with the menu's slots, or with `PlaceGhostRecipe` when the items are missing. - The screen state reports the recipe book's buttons, for harnesses. **Not in this PR:** - The server sends only crafting recipes in the book (this was already the case), so the furnace books stay empty on a Horizon server, and furnace placement is not handled server-side. - The client does not send `RecipeBookSeenRecipe` / `RecipeBookChangeSettings`, and the server does not handle them yet. ## Tests - Protocol: a round trip of a book with a shaped entry and a smithing entry that nests every slot display kind. - `tools/lan_e2e.py --check recipes` (new). The guest gets 4 oak logs, opens the inventory and the book, and clicks the planks recipe: - before (the #700 stack build, without this change): FAIL, `the guest's inventory has no recipe book`; - after: PASS, `{'known': 3, 'grid': {100: 'minecraft:oak_log'}}`. The screenshot shows the toast, and the craftable recipes are drawn as craftable. - `--check crafting --check chest` still pass. - `cargo fmt --all --check`: ok. - `cargo clippy --workspace --all-targets -- -D warnings`: ok. - `cargo test -p horizon-client --lib`: 821 passed. - `cargo test -p horizon-protocol`: 56 passed. - Local parity: one integration run covers #697, #700, #708 and this PR. The pass count follows in a comment. ## Block-break progress (reported, not changed) The window does not handle `ClientboundBlockDestructionPacket`, so other players' cracks are not drawn. The renderer draws a single crumbling overlay whose stage comes from a frame uniform (`crumbling_sprite` in `gfx.rs` / `entity.wgsl`). Showing several blocks at different stages needs that atlas rect per vertex in `breaking::geometry`. That change is in perf-gpu's area, and is reported to the orchestrator. 🤖 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:47 +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#2752
No description provided.