[PR #7217] [MERGED] The book learns a crafted recipe under its whole id #7418

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

📋 Pull Request Information

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

Base: main ← Head: fix-crafted-recipe-ids


📝 Commits (1)

  • c2e8cc0 The book learns a crafted recipe under its whole id

📊 Changes

6 files changed (+145 additions, -16 deletions)

View changed files

📝 crates/horizon-client/src/advancements.rs (+23 -0)
📝 crates/horizon-client/src/crafting.rs (+12 -0)
📝 crates/horizon-client/src/game.rs (+8 -2)
📝 crates/horizon-client/src/lan/advancements.rs (+72 -0)
📝 crates/horizon-client/src/lan/data.rs (+1 -8)
📝 crates/horizon-client/src/recipe_book.rs (+29 -6)

📄 Description

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

Fixes #7186.

What and why

The crafting copy names a minecraft: recipe bare (Recipes::sources drops the namespace, folder and world pack alike), and award_crafted handed that bare name on. The book, the network copy, the advancements' JSON and the saved file all know the recipe as minecraft:<name>, so a recipe unlocked only by crafting it had no display — never in the book, not after the craft, not after rejoining. Vanilla recipes are usually unlocked first by their advancements, under the whole id, which hid it. A recipe_crafted criterion never matched the bare name either, for the same reason — the second symptom, fixed and covered by a test here too.

crafting::qualified fills the default namespace in, shared with the lan copy's own. The book learns and forgets recipes under their whole id whatever the caller passes (Settings::add_recipes, remove_recipes), and award_crafted qualifies before the recipe_crafted trigger and the book. Reading a saved book already qualified bare names; a test keeps that, so books saved before the fix show their recipes too.

Proven

  • Both probe tests craft through the real Recipes::find_with (a folder recipe and a world pack's): each fixes that the crafting copy names it bare, then the book learns minecraft:<name> and initial_recipe_book carries an entry — both failed before the fix with an empty RecipeBookAdd.
  • a_recipe_crafted_criterion_matches_the_whole_id_only: the criterion's exact comparison (id_matches) rejects the bare name and takes the whole id award_crafted now passes.
  • a_book_saved_with_bare_names_reads_qualified: a pre-fix save with bare ids reads qualified.

Not proven

  • a craft in the game's window: no bot drove a real craft here — the test harness hosts the hub without the game, and a guest's craft runs in the game's lan_crafting (the bot sends ContainerClick fine; a crafting table's menu opens there, not in the harness) — and single-player was not run. The path is covered by the tests above, through the real find_with, add_recipes and initial_recipe_book.

Self-check

tools/pr_ready.py on DESKTOP-H7P5E7K against origin/main at 3feb84a5e, 9 min 54 s:

Check Result
Scope ✅ 6 files, +145 −16
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 612 passed
rustfmt / clippy ✅ / ✅
tests: horizon-client, horizon-client-lib ✅ 2117 passed
doc tests ✅

🤖 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/7217 **Author:** [@Qwerner88880](https://github.com/Qwerner88880) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix-crafted-recipe-ids` --- ### 📝 Commits (1) - [`c2e8cc0`](https://github.com/horizon-rust/horizon/commit/c2e8cc0fe2d04f98807dfa6f4641809989331836) The book learns a crafted recipe under its whole id ### 📊 Changes **6 files changed** (+145 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/advancements.rs` (+23 -0) 📝 `crates/horizon-client/src/crafting.rs` (+12 -0) 📝 `crates/horizon-client/src/game.rs` (+8 -2) 📝 `crates/horizon-client/src/lan/advancements.rs` (+72 -0) 📝 `crates/horizon-client/src/lan/data.rs` (+1 -8) 📝 `crates/horizon-client/src/recipe_book.rs` (+29 -6) </details> ### 📄 Description > 🤖 Opened by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally. Fixes #7186. ## What and why The crafting copy names a `minecraft:` recipe bare (`Recipes::sources` drops the namespace, folder and world pack alike), and `award_crafted` handed that bare name on. The book, the network copy, the advancements' JSON and the saved file all know the recipe as `minecraft:<name>`, so a recipe unlocked only by crafting it had no display — never in the book, not after the craft, not after rejoining. Vanilla recipes are usually unlocked first by their advancements, under the whole id, which hid it. A `recipe_crafted` criterion never matched the bare name either, for the same reason — the second symptom, fixed and covered by a test here too. `crafting::qualified` fills the default namespace in, shared with the lan copy's own. The book learns and forgets recipes under their whole id whatever the caller passes (`Settings::add_recipes`, `remove_recipes`), and `award_crafted` qualifies before the `recipe_crafted` trigger and the book. Reading a saved book already qualified bare names; a test keeps that, so books saved before the fix show their recipes too. ## Proven - Both probe tests craft through the real `Recipes::find_with` (a folder recipe and a world pack's): each fixes that the crafting copy names it bare, then the book learns `minecraft:<name>` and `initial_recipe_book` carries an entry — both failed before the fix with an empty `RecipeBookAdd`. - `a_recipe_crafted_criterion_matches_the_whole_id_only`: the criterion's exact comparison (`id_matches`) rejects the bare name and takes the whole id `award_crafted` now passes. - `a_book_saved_with_bare_names_reads_qualified`: a pre-fix save with bare ids reads qualified. ## Not proven - a craft in the game's window: no bot drove a real craft here — the test harness hosts the hub without the game, and a guest's craft runs in the game's `lan_crafting` (the bot sends `ContainerClick` fine; a crafting table's menu opens there, not in the harness) — and single-player was not run. The path is covered by the tests above, through the real `find_with`, `add_recipes` and `initial_recipe_book`. ## Self-check `tools/pr_ready.py` on DESKTOP-H7P5E7K against `origin/main` at 3feb84a5e, 9 min 54 s: | Check | Result | | --- | --- | | Scope | ✅ 6 files, +145 −16 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 612 passed | | rustfmt / clippy | ✅ / ✅ | | tests: horizon-client, horizon-client-lib | ✅ 2117 passed | | doc tests | ✅ | 🤖 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:39:15 +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#7418
No description provided.