[PR #1973] [MERGED] Save furnace, brewing stand and crafter edits made through a server menu #3902

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1973
Author: @kacpherek
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/1497-machine-menu-changes


📝 Commits (2)

  • bbc57aa Save furnace, brewing stand and crafter edits made through a server menu
  • bb3a289 Read the click's changed slots for the machine's setChanged

📊 Changes

1 file changed (+5 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/lan_crafting.rs (+5 -0)

📄 Description

Fixes #1497.

What and why

On the server thread (and for LAN guests and dedicated-server players), items put into or taken out of
a block container through its menu could roll back when the world was reopened or the chunk unloaded,
losing or duplicating them.

For chests, barrels, shulker boxes, hoppers and dispensers this was fixed on main by 467277ef ("Update
comparators when a guest changes a chest through its menu"): the click now calls container_changed,
which marks the chunk for saving. Furnaces (also blast furnaces and smokers), brewing stands and crafters
go through a different handler (lan_machine_click), which wrote the slots back to the block entity but
never marked it changed. A furnace with nothing burning changes nothing in its own tick, so nothing else
marked its chunk either: the issue's "idle furnace" case (ore without fuel) still rolled back.

Now lan_machine_click calls container_changed when the click changed the container's slots, like the
chest-like menus.

Vanilla reference

  • AbstractContainerMenu.doClick / quickMoveStack → Slot.setChanged → Container.setChanged →
    BlockEntity.setChanged (setBlocksDirty/markUnsaved on the chunk, and the comparator update).

Checked in game on the server thread (default) with horizon-ctl, in survival, using real menu
shift-clicks: a chest and a furnace placed, world quit and reopened so the chunk was saved; then

Step after quit and reopen
shift-click 7 diamonds into the chest chest holds 7 diamonds
shift-click 3 raw iron into the idle furnace (after a save, so nothing else marked the chunk) furnace holds 3 raw iron
shift-click the raw iron back out furnace empty, player has 3 raw iron
shift-click the diamonds back out chest empty, player has 7 diamonds

(/data get block and horizon-ctl inventory after each reopen.) The in-frame path does not use this
handler; it already marks the chunk in click_inventory.

Rebased onto upstream/main after FurnaceResultSlot.checkTakeAchievements landed in the same place; both stay, the award first. cargo check passes. The harness and in-game results below are from before that rebase.

No harness drives a server menu through a save; the harnesses next to the change still pass:

  • test_block_entity_storage_parity.py: client and server 78,251 block-entity storage lines match Rust
  • test_menu_click_parity.py: 8000/8000 cases match
  • test_lan_parity.py: 462 lan-parity cases match the pinned client (531 output lines)

Self-check

I did not paste a tools/pr_ready.py block: I work on Windows, where tools/parity.py cannot run (it needs
fcntl) and three horizon-client tests fail on upstream/main as well
(crash::tests::stacks_start_at_the_panicking_frame,
packs::cache::tests::directory_inputs_config_and_owned_output_recovery,
save::tests::session_lock_is_exclusive). cargo fmt --all -- --check passes; CI runs clippy and the
tests on Linux, and the harnesses above were run one by one (python tools/test_<name>_parity.py).


🔄 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/1973 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/1497-machine-menu-changes` --- ### 📝 Commits (2) - [`bbc57aa`](https://github.com/horizon-rust/horizon/commit/bbc57aa838c52a7120722a0bf4ea2df2f644c473) Save furnace, brewing stand and crafter edits made through a server menu - [`bb3a289`](https://github.com/horizon-rust/horizon/commit/bb3a289caaa091b9ffd910e51780bacb31f0ac4c) Read the click's changed slots for the machine's setChanged ### 📊 Changes **1 file changed** (+5 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_crafting.rs` (+5 -0) </details> ### 📄 Description Fixes #1497. ## What and why On the server thread (and for LAN guests and dedicated-server players), items put into or taken out of a block container through its menu could roll back when the world was reopened or the chunk unloaded, losing or duplicating them. For chests, barrels, shulker boxes, hoppers and dispensers this was fixed on main by 467277ef ("Update comparators when a guest changes a chest through its menu"): the click now calls `container_changed`, which marks the chunk for saving. Furnaces (also blast furnaces and smokers), brewing stands and crafters go through a different handler (`lan_machine_click`), which wrote the slots back to the block entity but never marked it changed. A furnace with nothing burning changes nothing in its own tick, so nothing else marked its chunk either: the issue's "idle furnace" case (ore without fuel) still rolled back. Now `lan_machine_click` calls `container_changed` when the click changed the container's slots, like the chest-like menus. ## Vanilla reference - `AbstractContainerMenu.doClick` / `quickMoveStack` → `Slot.setChanged` → `Container.setChanged` → `BlockEntity.setChanged` (`setBlocksDirty`/`markUnsaved` on the chunk, and the comparator update). Checked in game on the server thread (default) with `horizon-ctl`, in survival, using real menu shift-clicks: a chest and a furnace placed, world quit and reopened so the chunk was saved; then | Step | after quit and reopen | | --- | --- | | shift-click 7 diamonds into the chest | chest holds 7 diamonds | | shift-click 3 raw iron into the idle furnace (after a save, so nothing else marked the chunk) | furnace holds 3 raw iron | | shift-click the raw iron back out | furnace empty, player has 3 raw iron | | shift-click the diamonds back out | chest empty, player has 7 diamonds | (`/data get block` and `horizon-ctl inventory` after each reopen.) The in-frame path does not use this handler; it already marks the chunk in `click_inventory`. Rebased onto upstream/main after `FurnaceResultSlot.checkTakeAchievements` landed in the same place; both stay, the award first. `cargo check` passes. The harness and in-game results below are from before that rebase. No harness drives a server menu through a save; the harnesses next to the change still pass: - `test_block_entity_storage_parity.py`: client and server 78,251 block-entity storage lines match Rust - `test_menu_click_parity.py`: 8000/8000 cases match - `test_lan_parity.py`: 462 lan-parity cases match the pinned client (531 output lines) ## Self-check I did not paste a `tools/pr_ready.py` block: I work on Windows, where `tools/parity.py` cannot run (it needs `fcntl`) and three horizon-client tests fail on upstream/main as well (`crash::tests::stacks_start_at_the_panicking_frame`, `packs::cache::tests::directory_inputs_config_and_owned_output_recovery`, `save::tests::session_lock_is_exclusive`). `cargo fmt --all -- --check` passes; CI runs clippy and the tests on Linux, and the harnesses above were run one by one (`python tools/test_<name>_parity.py`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:08 +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#3902
No description provided.