[PR #76] [MERGED] Furnaces keep their cooking progress across menu clicks #2306

Closed
opened 2026-11-02 15:54:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/furnace-progress-69


📝 Commits (1)

  • 8c0586d Furnaces keep their cooking progress across menu clicks

📊 Changes

5 files changed (+123 additions, -17 deletions)

View changed files

📝 crates/horizon-client/examples/menu_fixture.rs (+35 -3)
📝 crates/horizon-client/src/containers.rs (+26 -0)
📝 crates/horizon-client/src/game.rs (+12 -11)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMenuOracle.java (+28 -0)
📝 tools/test_menu_click_parity.py (+22 -3)

📄 Description

What was wrong

After every click in an open furnace, blast furnace or smoker menu, the game zeroed the furnace's cooking timer, whatever the click did. Picking up an item in the inventory and putting it down elsewhere reset the smelting progress (#69). Picking up part of the input with an empty hand reset it too, through the older click path.

What vanilla does

AbstractFurnaceBlockEntity.setItem restarts cooking only for slot 0, and only when the new stack isn't the same item with the same components (ItemStack.isSameItemSameComponents). It then sets cookingTotalTime from the new input's recipe (getTotalCookTime(ServerLevel, …), 200 without a recipe) and zeroes cookingTimer. Menu clicks reach setItem only through Slot.setByPlayer/set. Taking part of a stack (ContainerHelper.removeItem) and merging into it (grow and then setByPlayer on the same stack) leave the progress alone.

The fix

Furnace::set_input mirrors setItem on the input slot. Furnace::input_clicked runs after a menu click and compares the input slot before and after: a click that left it unchanged, took part of it or merged into it keeps the progress, and anything else restarts cooking with the new total. Both click paths in game.rs (the menu engine and the plain pickup) use it.

Tests

tools/test_menu_click_parity.py gains furnace_be, blast_furnace_be and smoker_be. These are vanilla's furnace menus over real FurnaceBlockEntity/BlastFurnaceBlockEntity/SmokerBlockEntity instances in the oracle's stand-in server level, compared after every click with Furnace::input_clicked in menu_fixture. The cases mostly have something cooking, with the same item in the inventory and in hand, so merges, partial takes and swaps all happen.

  • With the old behaviour (timer zeroed on every click): 155/600 cases match.
  • With the fix: 1200/1200 for the furnace menus alone, and 8000/8000 for the whole harness.
  • cargo clippy -p horizon-client --all-targets -D warnings and cargo test -p horizon-client pass; tools/check_public_tree.py passes.

Fixes #69

🤖 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/76 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/furnace-progress-69` --- ### 📝 Commits (1) - [`8c0586d`](https://github.com/horizon-rust/horizon/commit/8c0586db4b290a66a7e3adb52cee143378ccbff8) Furnaces keep their cooking progress across menu clicks ### 📊 Changes **5 files changed** (+123 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/menu_fixture.rs` (+35 -3) 📝 `crates/horizon-client/src/containers.rs` (+26 -0) 📝 `crates/horizon-client/src/game.rs` (+12 -11) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaMenuOracle.java` (+28 -0) 📝 `tools/test_menu_click_parity.py` (+22 -3) </details> ### 📄 Description ## What was wrong After every click in an open furnace, blast furnace or smoker menu, the game zeroed the furnace's cooking timer, whatever the click did. Picking up an item in the inventory and putting it down elsewhere reset the smelting progress (#69). Picking up part of the input with an empty hand reset it too, through the older click path. ## What vanilla does `AbstractFurnaceBlockEntity.setItem` restarts cooking only for slot 0, and only when the new stack isn't the same item with the same components (`ItemStack.isSameItemSameComponents`). It then sets `cookingTotalTime` from the new input's recipe (`getTotalCookTime(ServerLevel, …)`, 200 without a recipe) and zeroes `cookingTimer`. Menu clicks reach `setItem` only through `Slot.setByPlayer`/`set`. Taking part of a stack (`ContainerHelper.removeItem`) and merging into it (`grow` and then `setByPlayer` on the same stack) leave the progress alone. ## The fix `Furnace::set_input` mirrors `setItem` on the input slot. `Furnace::input_clicked` runs after a menu click and compares the input slot before and after: a click that left it unchanged, took part of it or merged into it keeps the progress, and anything else restarts cooking with the new total. Both click paths in `game.rs` (the menu engine and the plain pickup) use it. ## Tests `tools/test_menu_click_parity.py` gains `furnace_be`, `blast_furnace_be` and `smoker_be`. These are vanilla's furnace menus over real `FurnaceBlockEntity`/`BlastFurnaceBlockEntity`/`SmokerBlockEntity` instances in the oracle's stand-in server level, compared after every click with `Furnace::input_clicked` in `menu_fixture`. The cases mostly have something cooking, with the same item in the inventory and in hand, so merges, partial takes and swaps all happen. - With the old behaviour (timer zeroed on every click): 155/600 cases match. - With the fix: 1200/1200 for the furnace menus alone, and 8000/8000 for the whole harness. - `cargo clippy -p horizon-client --all-targets -D warnings` and `cargo test -p horizon-client` pass; `tools/check_public_tree.py` passes. Fixes #69 🤖 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-02 15:54: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#2306
No description provided.