[PR #3380] [MERGED] Goat horns keep their instrument from the server (#3181) #4947

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3380
Author: @degepie
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/goat-horn-instrument-sync


📝 Commits (4)

  • c404ef5 Goat horns keep their instrument from the server
  • 57a6f4e Merge remote-tracking branch 'origin/main' into fix/goat-horn-instrument-sync
  • 8740d38 Merge remote-tracking branch 'origin/main' into fix/goat-horn-instrument-sync
  • 894848c Merge remote-tracking branch 'origin/main' into fix/goat-horn-instrument-sync

📊 Changes

5 files changed (+68 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/item_sync.rs (+5 -0)
📝 crates/horizon-client/src/lan/guest.rs (+34 -0)
📝 crates/horizon-protocol/examples/item_wire_probe.rs (+7 -2)
📝 crates/horizon-protocol/src/item.rs (+20 -0)
📝 tools/test_item_wire_parity.py (+2 -1)

📄 Description

🤖 Opened by degepie's AI agent (Claude Code), not by degepie personally.

Fixes #3181. Related: #2417 (horn use and sound). That issue needs this component to reach the client, and this PR only makes it arrive.

What

On a server, every goat horn showed as "Ponder". The client read minecraft:instrument (id 63) past in item/skip.rs without keeping it. The stack arrived with no component, and item_tooltip::instrument_line fell back to the item default, ponder_goat_horn.

How

The same pattern as ArmorTrim (Component::Trim):

  • horizon-protocol (item.rs): InstrumentComponent.STREAM_CODEC is a holder. A reference (id + 1) becomes Component::Instrument(id) and is written back as the same VarInt. A direct (inline, datapack-style) instrument stays Component::Raw and keeps its bytes, as a direct trim does.
  • Server to client (item_sync.rs): the id is named from the synced minecraft:instrument registry (already in the synced set, see lan/data.rs). The result is a "minecraft:sing_goat_horn" string, the persistent form the tooltip already reads.
  • LAN host and creative client to the wire (lan/guest.rs): minecraft:instrument is sent back by its registry id. This direction is covered by a unit test only.
  • Item wire harness: a new instrument registry fixture on a goat_horn. item_wire_probe now treats Instrument like Trim, as an exact id rather than a lossy type, so the harness checks its round trip byte for byte.

Verified

Vanilla 26.3 dedicated server (Mojang's server.jar, offline mode, local), joined with horizon-client --server, then from the server console:

give HornTest minecraft:goat_horn[minecraft:instrument="minecraft:sing_goat_horn"]
give HornTest minecraft:goat_horn[minecraft:instrument="minecraft:dream_goat_horn"]
give HornTest minecraft:goat_horn
horizon-ctl inventory v0.2.91 this branch
slot 0 goat_horn, no components {"minecraft:instrument":"minecraft:sing_goat_horn"}
slot 1 goat_horn, no components {"minecraft:instrument":"minecraft:dream_goat_horn"}
slot 2 (plain horn) no components no components (the default, ponder)
  • python3 tools/parity.py item_wire was run locally and passed (30 s): 375 stacks, all 122 component types covered. The vanilla oracle encodes instrument registry as 01e00b01003f07, and Horizon reads it with 0 bytes left and writes it back with same_bytes: true. The same holds for instrument direct and the goat horn's default.
  • Unit tests: components_read_past_keep_their_bytes gains the 63 case, and goat_horns_send_their_instrument_by_registry_id covers the LAN/creative direction.
  • pr_ready --quick is below. I ran the one affected harness by hand. The full --changed set is 355 harnesses, so it is left to CI.

pr_ready (tools/pr_ready.py --quick on b550, against origin/main at 3c9bb38e8, 44 s)

Check Result
Scope ✅ 5 files, +68 −3
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 399 passed (30 s)
rustfmt ✅ (5 s)
clippy ✅ (1 s)
tests: horizon-client, horizon-protocol ✅ 1382 passed (7 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/3380 **Author:** [@degepie](https://github.com/degepie) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/goat-horn-instrument-sync` --- ### 📝 Commits (4) - [`c404ef5`](https://github.com/horizon-rust/horizon/commit/c404ef5e2ad462cdca621c5a1c41fec62fa2c9b4) Goat horns keep their instrument from the server - [`57a6f4e`](https://github.com/horizon-rust/horizon/commit/57a6f4e9aa6df6c1fc8ac814a2ee0296c5eade83) Merge remote-tracking branch 'origin/main' into fix/goat-horn-instrument-sync - [`8740d38`](https://github.com/horizon-rust/horizon/commit/8740d3897c6a93f71d4f48560b0ca9afc438eb91) Merge remote-tracking branch 'origin/main' into fix/goat-horn-instrument-sync - [`894848c`](https://github.com/horizon-rust/horizon/commit/894848c17b1436b57af41dab03cc4e8af0071230) Merge remote-tracking branch 'origin/main' into fix/goat-horn-instrument-sync ### 📊 Changes **5 files changed** (+68 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/item_sync.rs` (+5 -0) 📝 `crates/horizon-client/src/lan/guest.rs` (+34 -0) 📝 `crates/horizon-protocol/examples/item_wire_probe.rs` (+7 -2) 📝 `crates/horizon-protocol/src/item.rs` (+20 -0) 📝 `tools/test_item_wire_parity.py` (+2 -1) </details> ### 📄 Description > 🤖 Opened by degepie's AI agent (Claude Code), not by degepie personally. Fixes #3181. Related: #2417 (horn use and sound). That issue needs this component to reach the client, and this PR only makes it arrive. ## What On a server, every goat horn showed as "Ponder". The client read `minecraft:instrument` (id 63) past in `item/skip.rs` without keeping it. The stack arrived with no component, and `item_tooltip::instrument_line` fell back to the item default, `ponder_goat_horn`. ## How The same pattern as `ArmorTrim` (`Component::Trim`): - `horizon-protocol` (`item.rs`): `InstrumentComponent.STREAM_CODEC` is a holder. A reference (id + 1) becomes `Component::Instrument(id)` and is written back as the same VarInt. A direct (inline, datapack-style) instrument stays `Component::Raw` and keeps its bytes, as a direct trim does. - Server to client (`item_sync.rs`): the id is named from the synced `minecraft:instrument` registry (already in the synced set, see `lan/data.rs`). The result is a `"minecraft:sing_goat_horn"` string, the persistent form the tooltip already reads. - LAN host and creative client to the wire (`lan/guest.rs`): `minecraft:instrument` is sent back by its registry id. This direction is covered by a unit test only. - Item wire harness: a new `instrument registry` fixture on a `goat_horn`. `item_wire_probe` now treats `Instrument` like `Trim`, as an exact id rather than a lossy type, so the harness checks its round trip byte for byte. ## Verified Vanilla 26.3 dedicated server (Mojang's `server.jar`, offline mode, local), joined with `horizon-client --server`, then from the server console: ``` give HornTest minecraft:goat_horn[minecraft:instrument="minecraft:sing_goat_horn"] give HornTest minecraft:goat_horn[minecraft:instrument="minecraft:dream_goat_horn"] give HornTest minecraft:goat_horn ``` | `horizon-ctl inventory` | v0.2.91 | this branch | |---|---|---| | slot 0 | `goat_horn`, no components | `{"minecraft:instrument":"minecraft:sing_goat_horn"}` | | slot 1 | `goat_horn`, no components | `{"minecraft:instrument":"minecraft:dream_goat_horn"}` | | slot 2 (plain horn) | no components | no components (the default, ponder) | - `python3 tools/parity.py item_wire` was run locally and **passed** (30 s): 375 stacks, all 122 component types covered. The vanilla oracle encodes `instrument registry` as `01e00b01003f07`, and Horizon reads it with 0 bytes left and writes it back with `same_bytes: true`. The same holds for `instrument direct` and the goat horn's default. - Unit tests: `components_read_past_keep_their_bytes` gains the 63 case, and `goat_horns_send_their_instrument_by_registry_id` covers the LAN/creative direction. - `pr_ready --quick` is below. I ran the one affected harness by hand. The full `--changed` set is 355 harnesses, so it is left to CI. **pr_ready** (`tools/pr_ready.py --quick` on b550, against origin/main at 3c9bb38e8, 44 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +68 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 399 passed (30 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 s) | | tests: horizon-client, horizon-protocol | ✅ 1382 passed (7 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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:09:06 +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#4947
No description provided.