[PR #4352] [MERGED] Loot: a goat horn from a loot table gets its instrument (set_instrument) #5578

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

📋 Pull Request Information

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

Base: main ← Head: fix/loot-set-instrument


📝 Commits (2)

  • fe8c643 Loot: set_instrument puts the picked instrument on the item (a goat horn's tune)
  • 5866611 Port map: SetInstrumentFunction.run is ported

📊 Changes

2 files changed (+49 additions, -3 deletions)

View changed files

📝 crates/horizon-world/src/loot.rs (+48 -2)
📝 tools/port_map/classes-08.tsv (+1 -1)

📄 Description

🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally.

Refs #3517 (row SetInstrumentFunction.run). Part of #3601. No other open PR touches loot functions.

What and why

A goat horn that comes out of a loot table had no instrument. set_instrument drew its random option (to keep the random sequence of the table) and threw it away, so the horn had no minecraft:instrument component: in a chest, a vault or a drop it was an empty horn.

Change

  • horizon-world/src/loot.rs: set_instrument puts the picked option in the stack's components as minecraft:instrument (the draw is the same one as before, so the table's random sequence does not change); the existing conversion to an item (structure_blocks, mob drops) carries it.
  • tools/port_map/classes-08.tsv: the row to port.

Vanilla reference

SetInstrumentFunction.run: options.getRandomElement(random) sets DataComponents.INSTRUMENT.

Testing

  • New unit test set_instrument_picks_one_of_its_options: a table with a goat horn and two options gives each horn exactly one minecraft:instrument, and both options come up across seeds. It fails without the change (no component).
  • Parity: entity_death_loot, spawn_loot, vault, bonus_chest pass (the random draws are unchanged).
  • pr_ready --quick (Python 3.12): Python tests (480), rustfmt, clippy and the horizon-world tests (279) pass.

🤖 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/4352 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/loot-set-instrument` --- ### 📝 Commits (2) - [`fe8c643`](https://github.com/horizon-rust/horizon/commit/fe8c64382df09a3540c1e0a53e73bd839012ca9d) Loot: set_instrument puts the picked instrument on the item (a goat horn's tune) - [`5866611`](https://github.com/horizon-rust/horizon/commit/58666111765a36fd34a7987a08e79380531212ac) Port map: SetInstrumentFunction.run is ported ### 📊 Changes **2 files changed** (+49 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/loot.rs` (+48 -2) 📝 `tools/port_map/classes-08.tsv` (+1 -1) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally. Refs #3517 (row `SetInstrumentFunction.run`). Part of #3601. No other open PR touches loot functions. ## What and why A goat horn that comes out of a loot table had no instrument. `set_instrument` drew its random option (to keep the random sequence of the table) and threw it away, so the horn had no `minecraft:instrument` component: in a chest, a vault or a drop it was an empty horn. ## Change - `horizon-world/src/loot.rs`: `set_instrument` puts the picked option in the stack's components as `minecraft:instrument` (the draw is the same one as before, so the table's random sequence does not change); the existing conversion to an item (`structure_blocks`, mob drops) carries it. - `tools/port_map/classes-08.tsv`: the row to `port`. ## Vanilla reference `SetInstrumentFunction.run`: `options.getRandomElement(random)` sets `DataComponents.INSTRUMENT`. ## Testing - New unit test `set_instrument_picks_one_of_its_options`: a table with a goat horn and two options gives each horn exactly one `minecraft:instrument`, and both options come up across seeds. It fails without the change (no component). - Parity: `entity_death_loot`, `spawn_loot`, `vault`, `bonus_chest` pass (the random draws are unchanged). - `pr_ready --quick` (Python 3.12): Python tests (480), rustfmt, clippy and the `horizon-world` tests (279) pass. 🤖 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-03 05:13:31 +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#5578
No description provided.