[PR #1856] [MERGED] Furnace: pay the experience a smelt earned #3822

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

📋 Pull Request Information

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

Base: main ← Head: fix/furnace-experience


📝 Commits (3)

  • bf81ae6 Furnace: pay the experience a smelt earned
  • b729cfc Furnace experience: createExperience's chance, orbs, every removal, guests
  • 83e8cbc Merge remote-tracking branch 'origin/main' into cg14/pr1856

📊 Changes

8 files changed (+164 additions, -2 deletions)

View changed files

📝 crates/horizon-client/examples/probe/menu_fixture.rs (+1 -0)
📝 crates/horizon-client/src/containers.rs (+52 -0)
📝 crates/horizon-client/src/crafting.rs (+8 -0)
📝 crates/horizon-client/src/game.rs (+43 -0)
📝 crates/horizon-client/src/game/lan_crafting.rs (+7 -0)
📝 crates/horizon-client/src/game/remote.rs (+1 -0)
📝 crates/horizon-client/src/game/spill.rs (+18 -1)
📝 crates/horizon-client/src/save.rs (+34 -1)

📄 Description

🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself.

Fixes #1732.

The furnace wrote RecipesUsed as an empty compound and nothing ever read it, so what a furnace smelted was lost twice: when the output was taken, and when the block was broken.

Three places, each following vanilla:

  • AbstractFurnaceBlockEntity.setRecipeUsed / burn: the furnace keeps recipesUsed (recipe id to count) and does not clear it until a payout. It is saved and loaded as the RecipesUsed compound the block entity already wrote empty, so a reload keeps what the furnace owes.
  • FurnaceResultSlot.checkTakeAchievements to AbstractFurnaceBlockEntity.awardUsedRecipesAndPopExperience: when the output slot loses an item, the counter is read and cleared. The payout goes straight to the player's points rather than through ExperienceOrb.award; the comment in game.rs marks that shortcut and when to upgrade it.
  • AbstractFurnaceBlockEntity.playerDestroy: breaking the block pays the same counter as orbs at the block, whatever the tool and whatever stays in the slots. The counter is read before the removal and paid only when the block really goes, so a failed removal keeps the experience instead of eating it.

AbstractFurnaceBlockEntity.createExperience floors each recipe's share on its own and then adds the floors, so two recipes worth 0.6 each pay nothing where flooring the sum would pay one. Furnace::owed follows that, and the unit test pins it.

How tested:

  • cargo check -p horizon-client --all-targets
  • containers::tests::experience_is_floored_per_recipe_and_not_on_the_sum pins the per-recipe floor against the sum.
  • save::tests::a_furnaces_recipes_used_survive_a_save pins that the counter survives an encode/decode round trip.

Not observed: a live smelt-and-take or a break in the running client, so this is a code-level fix with unit coverage rather than a measured repro. The pr_ready block follows as a comment on this PR.


🔄 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/1856 **Author:** [@Domanffe](https://github.com/Domanffe) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/furnace-experience` --- ### 📝 Commits (3) - [`bf81ae6`](https://github.com/horizon-rust/horizon/commit/bf81ae6358638575fb14192f2a5f82495a0ce13f) Furnace: pay the experience a smelt earned - [`b729cfc`](https://github.com/horizon-rust/horizon/commit/b729cfc83361456ffcb3ff926dbb97ad617cf600) Furnace experience: createExperience's chance, orbs, every removal, guests - [`83e8cbc`](https://github.com/horizon-rust/horizon/commit/83e8cbc4b634c2d9ae3003721be521b84ebd3148) Merge remote-tracking branch 'origin/main' into cg14/pr1856 ### 📊 Changes **8 files changed** (+164 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/probe/menu_fixture.rs` (+1 -0) 📝 `crates/horizon-client/src/containers.rs` (+52 -0) 📝 `crates/horizon-client/src/crafting.rs` (+8 -0) 📝 `crates/horizon-client/src/game.rs` (+43 -0) 📝 `crates/horizon-client/src/game/lan_crafting.rs` (+7 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+1 -0) 📝 `crates/horizon-client/src/game/spill.rs` (+18 -1) 📝 `crates/horizon-client/src/save.rs` (+34 -1) </details> ### 📄 Description > 🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself. Fixes #1732. The furnace wrote `RecipesUsed` as an empty compound and nothing ever read it, so what a furnace smelted was lost twice: when the output was taken, and when the block was broken. Three places, each following vanilla: - `AbstractFurnaceBlockEntity.setRecipeUsed` / `burn`: the furnace keeps `recipesUsed` (recipe id to count) and does not clear it until a payout. It is saved and loaded as the `RecipesUsed` compound the block entity already wrote empty, so a reload keeps what the furnace owes. - `FurnaceResultSlot.checkTakeAchievements` to `AbstractFurnaceBlockEntity.awardUsedRecipesAndPopExperience`: when the output slot loses an item, the counter is read and cleared. The payout goes straight to the player's points rather than through `ExperienceOrb.award`; the comment in `game.rs` marks that shortcut and when to upgrade it. - `AbstractFurnaceBlockEntity.playerDestroy`: breaking the block pays the same counter as orbs at the block, whatever the tool and whatever stays in the slots. The counter is read before the removal and paid only when the block really goes, so a failed removal keeps the experience instead of eating it. `AbstractFurnaceBlockEntity.createExperience` floors each recipe's share on its own and then adds the floors, so two recipes worth 0.6 each pay nothing where flooring the sum would pay one. `Furnace::owed` follows that, and the unit test pins it. How tested: - `cargo check -p horizon-client --all-targets` - `containers::tests::experience_is_floored_per_recipe_and_not_on_the_sum` pins the per-recipe floor against the sum. - `save::tests::a_furnaces_recipes_used_survive_a_save` pins that the counter survives an encode/decode round trip. Not observed: a live smelt-and-take or a break in the running client, so this is a code-level fix with unit coverage rather than a measured repro. The `pr_ready` block follows as a comment on this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:34 +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#3822
No description provided.