[PR #4339] [MERGED] Encode cooking recipes into the recipe book #5570

Closed
opened 2026-11-03 05:13:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4339
Author: @MSedgeMC
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/3962-cooking-recipe-book


📝 Commits (1)

  • 6a03966 Encode cooking recipes into the recipe book

📊 Changes

2 files changed (+272 additions, -34 deletions)

View changed files

📝 crates/horizon-client/src/lan/advancements.rs (+270 -32)
📝 crates/horizon-client/src/recipe_book.rs (+2 -2)

📄 Description

Fixes #3962.

AbstractCookingRecipe.display() returns one FurnaceRecipeDisplay — ingredient, AnyFuel, result, crafting station, cooking time, experience — for all four cooking types; only furnaceIcon() and the book category differ. The category is chosen by the recipe (recipe.recipeBookCategory()), not derived by the client: smelting food/blocks/other → furnace_food/blocks/misc, blasting blocks → blast_furnace_blocks and everything else → blast_furnace_misc, smoking → smoker_food, campfire → campfire.

Horizon's book_entries encoded crafting_shaped and crafting_shapeless and returned an empty list for every other type, so no cooking display ever reached a client — and since sync_client_book returns early when the window is remote, packets are the only source under the server thread. Furnace, blast furnace and smoker books were empty for single player, LAN guests and dedicated players alike.

One shared arm encodes the furnace display; crafting_category/crafting_station in recipe_book.rs went pub(crate) so the encoder reuses the client's own mapping rather than duplicating strings. The shaped/shapeless bytes are unchanged and the _ => fallback still covers stonecutting, smithing and transmute, which no book tab lists.

What is proven: both new tests ran on a build box — cargo test -p horizon-client --lib reaches_the → 4 passed. They load vanilla's real copper_ingot_from_smelting_raw_copper and redstone_from_blasting_redstone_ore from a fixture, run the encoder, and decode the bytes with the client's own RecipeBookEntry::read, asserting the furnace display, all four slots, duration 200, experience 0.7, the category, group, requirements and flags. They are red on today's code: the cooking types hit the fallback, so the entry list is empty.

What is not proven: no in-game check that a furnace tab actually refreshes in the client; smoking and campfire share the tested arm but their category branches are untested; there is no vanilla-vs-Horizon harness for this packet. Two things worth knowing rather than fixing here: campfire entries are encoded and stored but appear in no tab — which is what the jar shows, since none of the four book screens lists CAMPFIRE — and ghost_display now also yields furnace displays, as vanilla's place-recipe path does.


🔄 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/4339 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/3962-cooking-recipe-book` --- ### 📝 Commits (1) - [`6a03966`](https://github.com/horizon-rust/horizon/commit/6a03966205362979f59c737010dc2b9e64769f35) Encode cooking recipes into the recipe book ### 📊 Changes **2 files changed** (+272 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/lan/advancements.rs` (+270 -32) 📝 `crates/horizon-client/src/recipe_book.rs` (+2 -2) </details> ### 📄 Description Fixes #3962. `AbstractCookingRecipe.display()` returns one `FurnaceRecipeDisplay` — ingredient, `AnyFuel`, result, crafting station, cooking time, experience — for **all four** cooking types; only `furnaceIcon()` and the book category differ. The category is chosen by the recipe (`recipe.recipeBookCategory()`), not derived by the client: smelting food/blocks/other → `furnace_food`/`blocks`/`misc`, blasting blocks → `blast_furnace_blocks` and everything else → `blast_furnace_misc`, smoking → `smoker_food`, campfire → `campfire`. Horizon's `book_entries` encoded `crafting_shaped` and `crafting_shapeless` and returned an empty list for every other type, so no cooking display ever reached a client — and since `sync_client_book` returns early when the window is remote, packets are the only source under the server thread. Furnace, blast furnace and smoker books were empty for single player, LAN guests and dedicated players alike. One shared arm encodes the furnace display; `crafting_category`/`crafting_station` in `recipe_book.rs` went `pub(crate)` so the encoder reuses the client's own mapping rather than duplicating strings. The shaped/shapeless bytes are unchanged and the `_ =>` fallback still covers stonecutting, smithing and transmute, which no book tab lists. **What is proven:** both new tests ran on a build box — `cargo test -p horizon-client --lib reaches_the` → 4 passed. They load vanilla's real `copper_ingot_from_smelting_raw_copper` and `redstone_from_blasting_redstone_ore` from a fixture, run the encoder, and decode the bytes with the client's own `RecipeBookEntry::read`, asserting the furnace display, all four slots, duration 200, experience 0.7, the category, group, requirements and flags. They are red on today's code: the cooking types hit the fallback, so the entry list is empty. **What is not proven:** no in-game check that a furnace tab actually refreshes in the client; smoking and campfire share the tested arm but their category branches are untested; there is no vanilla-vs-Horizon harness for this packet. Two things worth knowing rather than fixing here: campfire entries are encoded and stored but appear in no tab — which is what the jar shows, since none of the four book screens lists `CAMPFIRE` — and `ghost_display` now also yields furnace displays, as vanilla's place-recipe path does. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:29 +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#5570
No description provided.