[PR #6482] [MERGED] Recipe book sync sends empty ingredients for NeoForge's object shapes #6906

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6482
Author: @Qwerner88880
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: hooks-holder-set


📝 Commits (1)

  • 4f48e48 Recipe book sync sends empty ingredients for NeoForge's object shapes

📊 Changes

4 files changed (+469 additions, -52 deletions)

View changed files

📝 crates/horizon-client/src/lan/advancements.rs (+149 -32)
📝 crates/horizon-client/src/lan/data.rs (+8 -2)
📝 crates/horizon-client/src/lan/recipes.rs (+134 -15)
📝 crates/horizon-client/tests/lan_bot.rs (+178 -3)

📄 Description

🤖 Opened by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally.

Fixes #6368.

What and why

holder_set writes any JSON object as an empty list (varint 1), so a recipe whose ingredient is one of NeoForge's standard shapes — neoforge:compound, intersection, difference — reached a connected client with an empty ingredient slot. The crafting copy resolves these shapes to flat item lists where it loads them, but the network copy read its recipe files separately: neither the book's displays nor UpdateRecipes' property sets and stonecutter saw the resolved lists.

The network copy now loads through one place, network_recipes: every recipe file and overlay recipe, each ingredient object — NeoForge's shapes, a brewing slot's item predicate — replaced by its flat item list (the shaped key's values, ingredients, ingredient, the smithing trio, the brewing pair), then everything packed back as the compact JSON text #6265 keeps (ServerAdvancements::load and update_recipes share the one copy; the group numbers come from the same pass). A recipe that keeps an ingredient object no loader can parse (a mod's own kind) is not sent at all: the server does not load it, and an empty ingredient slot in its place misleads the client. Only vanilla recipe types are normalized; a mod's own type keeps its JSON whole. A missing item catalog leaves the shapes unresolved with a warning instead of silently.

An item the registries do not know is left out of the ingredients it was named in, not sent as id 0.

The lan_bot test drives the whole path live: a server over the vanilla data with a pack of compound recipes, two guests joining, each reading its own UpdateRecipes (the furnace input set and a stonecutting entry hold the compound's items) and RecipeBookAdd (the book entry's requirements hold them).

Numbers

  • 2042 vanilla recipes, none lost; 279 of them (the brewing files, the {"item": …} predicates) now carry flat lists, as intended.
  • Items::catalog costs about 0.2 s (release, a desktop) once per server start and each /reload — this path didn't load the catalog before.

Not proven

  • a vanilla (non-Horizon) client: both "clients" in the live test are protocol bots.
  • the recipe book window itself: proven on the wire (the packets and their decode), no GUI opened.
  • a live /reload: both reload sites read through the same functions, but no live run.
  • an ingredient whose every item is unknown to the registries still goes out as an empty list (before, one such item went out as id 0, which was also wrong — not a regression, called out here).

Parity

Not run locally (no vanilla data here); CI's parity job picks the affected harnesses.

Self-check

tools/pr_ready.py on DESKTOP-H7P5E7K against origin/main at dd289c890, 6 min 0 s:

Check Result
Scope ✅ 4 files, +469 −52
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 594 passed (1 min 45 s)
rustfmt ✅ (14 s)
clippy ✅ (55 s)
tests: horizon-client-lib ✅ 1320 passed (3 min 2 s), the live two-guest test among them
doc tests ✅ (1 s)

🤖 Generated with ZCode AI agent (GLM-5.3)


🔄 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/6482 **Author:** [@Qwerner88880](https://github.com/Qwerner88880) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `hooks-holder-set` --- ### 📝 Commits (1) - [`4f48e48`](https://github.com/horizon-rust/horizon/commit/4f48e48a43b4f0cfe363d294081c7de1aa775784) Recipe book sync sends empty ingredients for NeoForge's object shapes ### 📊 Changes **4 files changed** (+469 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/advancements.rs` (+149 -32) 📝 `crates/horizon-client/src/lan/data.rs` (+8 -2) 📝 `crates/horizon-client/src/lan/recipes.rs` (+134 -15) 📝 `crates/horizon-client/tests/lan_bot.rs` (+178 -3) </details> ### 📄 Description > 🤖 Opened by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally. Fixes #6368. ## What and why `holder_set` writes any JSON object as an empty list (varint 1), so a recipe whose ingredient is one of NeoForge's standard shapes — `neoforge:compound`, `intersection`, `difference` — reached a connected client with an empty ingredient slot. The crafting copy resolves these shapes to flat item lists where it loads them, but the network copy read its recipe files separately: neither the book's displays nor `UpdateRecipes`' property sets and stonecutter saw the resolved lists. The network copy now loads through one place, `network_recipes`: every recipe file and overlay recipe, each ingredient object — NeoForge's shapes, a brewing slot's `item` predicate — replaced by its flat item list (the shaped key's values, `ingredients`, `ingredient`, the smithing trio, the brewing pair), then everything packed back as the compact JSON text #6265 keeps (`ServerAdvancements::load` and `update_recipes` share the one copy; the group numbers come from the same pass). A recipe that keeps an ingredient object no loader can parse (a mod's own kind) is not sent at all: the server does not load it, and an empty ingredient slot in its place misleads the client. Only vanilla recipe types are normalized; a mod's own type keeps its JSON whole. A missing item catalog leaves the shapes unresolved with a warning instead of silently. An item the registries do not know is left out of the ingredients it was named in, not sent as id 0. The `lan_bot` test drives the whole path live: a server over the vanilla data with a pack of compound recipes, two guests joining, each reading its own `UpdateRecipes` (the furnace input set and a stonecutting entry hold the compound's items) and `RecipeBookAdd` (the book entry's requirements hold them). ## Numbers - 2042 vanilla recipes, none lost; 279 of them (the brewing files, the `{"item": …}` predicates) now carry flat lists, as intended. - `Items::catalog` costs about 0.2 s (release, a desktop) once per server start and each `/reload` — this path didn't load the catalog before. ## Not proven - a vanilla (non-Horizon) client: both "clients" in the live test are protocol bots. - the recipe book window itself: proven on the wire (the packets and their decode), no GUI opened. - a live `/reload`: both reload sites read through the same functions, but no live run. - an ingredient whose every item is unknown to the registries still goes out as an empty list (before, one such item went out as id 0, which was also wrong — not a regression, called out here). ## Parity Not run locally (no vanilla data here); CI's parity job picks the affected harnesses. ## Self-check `tools/pr_ready.py` on DESKTOP-H7P5E7K against `origin/main` at dd289c890, 6 min 0 s: | Check | Result | | --- | --- | | Scope | ✅ 4 files, +469 −52 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 594 passed (1 min 45 s) | | rustfmt | ✅ (14 s) | | clippy | ✅ (55 s) | | tests: horizon-client-lib | ✅ 1320 passed (3 min 2 s), the live two-guest test among them | | doc tests | ✅ (1 s) | 🤖 Generated with ZCode AI agent (GLM-5.3) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:28:53 +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#6906
No description provided.