[PR #6859] [MERGED] A world data pack's crafting recipe shows its result in the crafting table #7150

Closed
opened 2026-11-03 06:34:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6859
Author: @DUzzL
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/6733-datapack-craft-result


📝 Commits (1)

  • 4cc1135 Server thread: a world data pack's crafting recipe shows its result in the crafting table

📊 Changes

3 files changed (+104 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/game/remote.rs (+27 -1)
📝 tools/lan_e2e.py (+73 -0)

📄 Description

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

Fixes #6733

What

In single player (the server thread) and on a LAN, a crafting recipe from a world's data pack now shows its result in the crafting table and in the 2x2 grid.

Why

The window drew the result slot from its own recipe table (craft_result() -> craft_recipe() -> self.res.recipes()) and dropped the server's slot ("recomputed from the grid"). A world's data packs are only in the server's tables, so the window found no recipe. The server crafted fine: Shift-clicking the empty-looking slot gave the diamonds, so this is only what the window shows.

Choice: the server's result, not a synced recipe table

Vanilla's client never computes the result. CraftingMenu.slotChangedCraftingGrid sets it on the server and ClientboundContainerSetSlotPacket (slot 0) sends it. The window now keeps that slot (Remote.craft_result) and draws it, for the open menu only (container id matches, so the inventory menu's slot 0 does not overwrite a table's). It is cleared when the menu closes. Syncing every pack's recipes to the client would be a protocol change and would still not cover recipe types the client does not know.

The window's click prediction (menu_session) still uses its own tables. send_clicks keeps the result the engine claims to have changed, because the server agrees to such a claim (click_agreed) and sends no slot 0 then. A result the engine does not claim (a pack recipe) is sent by the server, as in vanilla.

Not changed: the deprecated in-frame path (--in-frame), and the recipe book (it still builds from the window's tables, recipe_book.rs:379; not checked here).

Vanilla: CraftingMenu.slotChangedCraftingGrid, ClientboundContainerSetSlotPacket, ClientPacketListener.handleContainerSetSlot.

Evidence

Repro as in the issue (world W, datapacks/repro with dirt_to_diamond), 4 dirt in the table's grid, driven with horizon-ctl:

  • Before (main): slot 200 empty, the grid holds 4 dirt; Shift-click on it still crafts 4 diamonds (the server works).
  • After: slot 200 shows minecraft:diamond x1; a plain click takes it (carried: diamond, grid 3 dirt); taking the last dirt out clears it.

New check python tools/lan_e2e.py --check datapack-recipe (writes the pack, reopens the world, host window and a LAN guest each put one dirt in a table):

  • Before: FAIL, host: the pack recipe shows {'result': (None, None), ...}
  • After: PASS for host and guest (result diamond x1, taking it carries diamond x1, the slot is empty once the dirt is used up).

Regression runs (lan_e2e.py, server thread, LAN guest): crafting, recipe-shift, clicks, shift-drag, shift-double-click, crafter, predict pass. menu-transfer fails the same way on main (recipe book state) and recipes fails the same way on main when run after recipe-shift (it passes alone, before and after). A first version without the send_clicks part left a stale result after a Shift-click craft (recipe-shift failed); that is why send_clicks has it.

Not run: a dedicated server; the whole lan_e2e suite.

pr_ready

Failures that are not from this change: test_world_input_capture (its capture.exe panics here), native_ingredient_stays_hookable (searches } in a CRLF checkout), and Parity (several of this machine's agents write the same .local/parity-runner folder; the runs collided with PermissionError, so it did not finish). rustfmt failed on the first run, fixed in the pushed commit.

pr_ready (tools/pr_ready.py --base upstream/main on DESKTOP-6RJOI59, against upstream/main at 2556a20c7, 53 min 47 s)

Check Result
Scope ✅ 3 files, +102 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 602 run, FAILED (errors=1, skipped=2) (4 min 39 s)
rustfmt ❌ failed (1 min 10 s)
clippy ✅ (6 min 8 s)
tests: horizon-client ❌ 600 passed, 1 failed (9 min 48 s)
doc tests ✅ 0 passed (38 s)
content root tests ➖ content root untouched
mod API up to date ✅ (1 min 4 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ❌ 164 affected, (29 min 16 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/6859 **Author:** [@DUzzL](https://github.com/DUzzL) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/6733-datapack-craft-result` --- ### 📝 Commits (1) - [`4cc1135`](https://github.com/horizon-rust/horizon/commit/4cc1135dc15d53145c9a80e06ea352c0cf08348f) Server thread: a world data pack's crafting recipe shows its result in the crafting table ### 📊 Changes **3 files changed** (+104 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+27 -1) 📝 `tools/lan_e2e.py` (+73 -0) </details> ### 📄 Description > 🤖 Opened by DUzzL's AI agent (Claude Code), not by DUzzL himself. Fixes #6733 ## What In single player (the server thread) and on a LAN, a crafting recipe from a world's data pack now shows its result in the crafting table and in the 2x2 grid. ## Why The window drew the result slot from its own recipe table (`craft_result()` -> `craft_recipe()` -> `self.res.recipes()`) and dropped the server's slot ("recomputed from the grid"). A world's data packs are only in the server's tables, so the window found no recipe. The server crafted fine: Shift-clicking the empty-looking slot gave the diamonds, so this is only what the window shows. ## Choice: the server's result, not a synced recipe table Vanilla's client never computes the result. `CraftingMenu.slotChangedCraftingGrid` sets it on the server and `ClientboundContainerSetSlotPacket` (slot 0) sends it. The window now keeps that slot (`Remote.craft_result`) and draws it, for the open menu only (container id matches, so the inventory menu's slot 0 does not overwrite a table's). It is cleared when the menu closes. Syncing every pack's recipes to the client would be a protocol change and would still not cover recipe types the client does not know. The window's click prediction (`menu_session`) still uses its own tables. `send_clicks` keeps the result the engine claims to have changed, because the server agrees to such a claim (`click_agreed`) and sends no slot 0 then. A result the engine does not claim (a pack recipe) is sent by the server, as in vanilla. Not changed: the deprecated in-frame path (`--in-frame`), and the recipe book (it still builds from the window's tables, `recipe_book.rs:379`; not checked here). Vanilla: `CraftingMenu.slotChangedCraftingGrid`, `ClientboundContainerSetSlotPacket`, `ClientPacketListener.handleContainerSetSlot`. ## Evidence Repro as in the issue (world `W`, `datapacks/repro` with `dirt_to_diamond`), 4 dirt in the table's grid, driven with horizon-ctl: - Before (main): slot 200 empty, the grid holds 4 dirt; Shift-click on it still crafts 4 diamonds (the server works). - After: slot 200 shows `minecraft:diamond` x1; a plain click takes it (carried: diamond, grid 3 dirt); taking the last dirt out clears it. New check `python tools/lan_e2e.py --check datapack-recipe` (writes the pack, reopens the world, host window and a LAN guest each put one dirt in a table): - Before: FAIL, `host: the pack recipe shows {'result': (None, None), ...}` - After: PASS for host and guest (result diamond x1, taking it carries diamond x1, the slot is empty once the dirt is used up). Regression runs (`lan_e2e.py`, server thread, LAN guest): `crafting`, `recipe-shift`, `clicks`, `shift-drag`, `shift-double-click`, `crafter`, `predict` pass. `menu-transfer` fails the same way on main (recipe book state) and `recipes` fails the same way on main when run after `recipe-shift` (it passes alone, before and after). A first version without the `send_clicks` part left a stale result after a Shift-click craft (`recipe-shift` failed); that is why `send_clicks` has it. Not run: a dedicated server; the whole `lan_e2e` suite. ## pr_ready Failures that are not from this change: `test_world_input_capture` (its `capture.exe` panics here), `native_ingredient_stays_hookable` (searches ` } ` in a CRLF checkout), and Parity (several of this machine's agents write the same `.local/parity-runner` folder; the runs collided with `PermissionError`, so it did not finish). rustfmt failed on the first run, fixed in the pushed commit. **pr_ready** (`tools/pr_ready.py --base upstream/main` on DESKTOP-6RJOI59, against upstream/main at 2556a20c7, 53 min 47 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +102 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 602 run, FAILED (errors=1, skipped=2) (4 min 39 s) | | rustfmt | ❌ failed (1 min 10 s) | | clippy | ✅ (6 min 8 s) | | tests: horizon-client | ❌ 600 passed, 1 failed (9 min 48 s) | | doc tests | ✅ 0 passed (38 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (1 min 4 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ❌ 164 affected, (29 min 16 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:34:49 +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#7150
No description provided.