[PR #2318] [MERGED] mods: recipes.place and recipes.give, a recipe viewer's actions #4200

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

📋 Pull Request Information

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

Base: main ← Head: feat/mod-recipe-actions


📝 Commits (4)

  • db13c68 mods: recipes.place and recipes.give, a recipe viewer's actions
  • f6ff231 Merge branch 'feat/mod-recipe-pages-game' into feat/mod-recipe-actions
  • b28b499 mods: recipes.give hands out one stack at most
  • bd1436f Merge branch 'feat/mod-recipe-pages-game' into feat/mod-recipe-actions

📊 Changes

13 files changed (+256 additions, -10 deletions)

View changed files

📝 crates/cargo-horizon-mod/src/check.rs (+4 -0)
📝 crates/horizon-client/src/game/mod_recipes.rs (+22 -0)
📝 crates/horizon-client/src/game/mods.rs (+14 -0)
📝 crates/horizon-client/src/game/recipe_book.rs (+28 -0)
📝 crates/horizon-mod-sdk/wit/horizon.wit (+12 -0)
📝 crates/horizon-mods/src/api_level.rs (+3 -1)
📝 crates/horizon-mods/src/manifest.rs (+3 -1)
📝 crates/horizon-mods/src/runtime.rs (+63 -0)
📝 crates/horizon-mods/tests/sandbox.rs (+42 -1)
📝 crates/horizon-mods/tests/ui_guest/src/lib.rs (+60 -4)
📝 docs/api/mods-reference.md (+3 -1)
📝 docs/api/stability.md (+1 -1)
📝 docs/mods.md (+1 -1)

📄 Description

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

Part C of the recipe-viewer plan: the two actions a recipe viewer needs. Stacked on #2306 (then #2305, #2301, #2300, #2284).

What it adds

  • recipes.place(book-id, all) is the recipe book's click, in the open inventory's or crafting table's grid.
    • On a server it sends ServerboundPlaceRecipePacket; in this window's own world (in-frame) it places through the menu engine, like the book.
    • It is refused as vanilla's handlePlaceRecipe refuses it (checked against the 26.3 bytecode): no crafting screen open, a recipe the player's book doesn't hold, or one impossible to place. On a server, the server checks again.
    • A recipe missing items shows as a ghost in the grid, as from the book.
  • recipes.give(stack) works in creative mode only. It gives the stack as the creative inventory does: the selected slot, then the hotbar, then the inventory. A server hears it as SetCreativeModeSlot through the creative inventory's existing sync, and refuses it there for a survival player.
  • Results. Both answer at once from the tick's snapshot: two new fields, placing and creative, plus the known book ids. Each hook call may make at most 36 of them.
  • Docs. Capability recipes' description now says it can place recipes and, in creative mode, give items. The docs, stability.md and mods-reference.md are updated, and cargo horizon-mod check reports both actions.

Checks

  • pr_ready:

pr_ready (tools/pr_ready.py --quick --base feat/mod-recipe-pages-game on ludovics-mac-mini, against feat/mod-recipe-pages-game at ad557fef4, 8 min 28 s)

Check Result
Scope ✅ 13 files, +251 −10
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (10 s)
clippy ✅ (58 s)
tests: cargo-horizon-mod, horizon-client, horizon-mod-sdk, horizon-mods, horizon-mods-test-ui-guest ✅ 1372 passed (6 min 9 s)
doc tests ✅ 2 passed (40 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (2 s)
launcher clippy ✅ (7 s)
launcher tests ✅ 132 passed (16 s)
Parity ➖ 115 affected, to run in CI (--quick): ambient_sound, arrow, audio_attributes, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_transformer, breaking_model, camera and 103 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)
  • Clippy. cargo clippy --all-targets --all-features -D warnings on horizon-mods, the SDK, cargo-horizon-mod and the test guest, and on horizon-client with --features mods: clean.
  • Sandbox. Place is refused without a screen and for an unknown recipe, then sent with all. Give is refused outside creative, then sent with the item id.
  • E2E (scratch driver, the test guest's /recipe_place ID [all] [later] and /recipe_give ITEM N): 58/58 across in-frame, server thread, LAN guest (host in-frame), LAN guest (host on its server thread) and a dedicated server's guest. In each mode:
    • place is refused with no screen open;
    • give is refused in survival;
    • with the inventory open, place puts one oak log in the 2x2 grid and the result shows 4 planks, as the server answers;
    • after /recipe take, place is refused and the grid stays empty;
    • in creative, give adds 2 diamonds, and the world's side counts them (/clear @s minecraft:diamond 0 → "Found 2 matching item(s)");
    • no panic and no stopped mod.

🤖 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/2318 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/mod-recipe-actions` --- ### 📝 Commits (4) - [`db13c68`](https://github.com/horizon-rust/horizon/commit/db13c68585d2f491e0329f6897279176bf18d8ec) mods: recipes.place and recipes.give, a recipe viewer's actions - [`f6ff231`](https://github.com/horizon-rust/horizon/commit/f6ff2319a54333a3a04d5e5dcd86d589c0c8ce9f) Merge branch 'feat/mod-recipe-pages-game' into feat/mod-recipe-actions - [`b28b499`](https://github.com/horizon-rust/horizon/commit/b28b4991359b3111ac2249d0c3b9b6276684cc66) mods: recipes.give hands out one stack at most - [`bd1436f`](https://github.com/horizon-rust/horizon/commit/bd1436f1624ad62596602b71f5fb954c9590d309) Merge branch 'feat/mod-recipe-pages-game' into feat/mod-recipe-actions ### 📊 Changes **13 files changed** (+256 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/cargo-horizon-mod/src/check.rs` (+4 -0) 📝 `crates/horizon-client/src/game/mod_recipes.rs` (+22 -0) 📝 `crates/horizon-client/src/game/mods.rs` (+14 -0) 📝 `crates/horizon-client/src/game/recipe_book.rs` (+28 -0) 📝 `crates/horizon-mod-sdk/wit/horizon.wit` (+12 -0) 📝 `crates/horizon-mods/src/api_level.rs` (+3 -1) 📝 `crates/horizon-mods/src/manifest.rs` (+3 -1) 📝 `crates/horizon-mods/src/runtime.rs` (+63 -0) 📝 `crates/horizon-mods/tests/sandbox.rs` (+42 -1) 📝 `crates/horizon-mods/tests/ui_guest/src/lib.rs` (+60 -4) 📝 `docs/api/mods-reference.md` (+3 -1) 📝 `docs/api/stability.md` (+1 -1) 📝 `docs/mods.md` (+1 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part C of the recipe-viewer plan: the two actions a recipe viewer needs. Stacked on #2306 (then #2305, #2301, #2300, #2284). ## What it adds - **`recipes.place(book-id, all)`** is the recipe book's click, in the open inventory's or crafting table's grid. - On a server it sends `ServerboundPlaceRecipePacket`; in this window's own world (in-frame) it places through the menu engine, like the book. - It is refused as vanilla's `handlePlaceRecipe` refuses it (checked against the 26.3 bytecode): no crafting screen open, a recipe the player's book doesn't hold, or one impossible to place. On a server, the server checks again. - A recipe missing items shows as a ghost in the grid, as from the book. - **`recipes.give(stack)`** works in creative mode only. It gives the stack as the creative inventory does: the selected slot, then the hotbar, then the inventory. A server hears it as `SetCreativeModeSlot` through the creative inventory's existing sync, and refuses it there for a survival player. - **Results.** Both answer at once from the tick's snapshot: two new fields, `placing` and `creative`, plus the known book ids. Each hook call may make at most 36 of them. - **Docs.** Capability `recipes`' description now says it can place recipes and, in creative mode, give items. The docs, stability.md and mods-reference.md are updated, and `cargo horizon-mod check` reports both actions. ## Checks - **pr_ready:** **pr_ready** (`tools/pr_ready.py --quick --base feat/mod-recipe-pages-game` on ludovics-mac-mini, against feat/mod-recipe-pages-game at ad557fef4, 8 min 28 s) | Check | Result | | --- | --- | | Scope | ✅ 13 files, +251 −10 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (10 s) | | clippy | ✅ (58 s) | | tests: cargo-horizon-mod, horizon-client, horizon-mod-sdk, horizon-mods, horizon-mods-test-ui-guest | ✅ 1372 passed (6 min 9 s) | | doc tests | ✅ 2 passed (40 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (2 s) | | launcher clippy | ✅ (7 s) | | launcher tests | ✅ 132 passed (16 s) | | Parity | ➖ 115 affected, to run in CI (--quick): ambient_sound, arrow, audio_attributes, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_transformer, breaking_model, camera and 103 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | - **Clippy.** `cargo clippy --all-targets --all-features -D warnings` on horizon-mods, the SDK, cargo-horizon-mod and the test guest, and on horizon-client with `--features mods`: clean. - **Sandbox.** Place is refused without a screen and for an unknown recipe, then sent with `all`. Give is refused outside creative, then sent with the item id. - **E2E** (scratch driver, the test guest's `/recipe_place ID [all] [later]` and `/recipe_give ITEM N`): 58/58 across in-frame, server thread, LAN guest (host in-frame), LAN guest (host on its server thread) and a dedicated server's guest. In each mode: - place is refused with no screen open; - **give is refused in survival**; - with the inventory open, place puts one oak log in the 2x2 grid and the result shows 4 planks, as the server answers; - after `/recipe take`, place is refused and the grid stays empty; - in creative, give adds 2 diamonds, and the world's side counts them (`/clear @s minecraft:diamond 0` → "Found 2 matching item(s)"); - no panic and no stopped mod. 🤖 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:15:26 +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#4200
No description provided.