[PR #1631] [MERGED] Multiplayer: read every item data component, so a server's inventory, recipe book and advancements load #3647

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1631
Author: @some-du6e
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

Base: main ← Head: fix/item-components


📝 Commits (1)

  • 9223b40 Decode every item data component a server sends

📊 Changes

7 files changed (+871 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+2 -0)
📝 crates/horizon-protocol/Cargo.toml (+4 -0)
➕ crates/horizon-protocol/examples/item_wire_probe.rs (+64 -0)
📝 crates/horizon-protocol/src/item.rs (+42 -3)
➕ crates/horizon-protocol/src/item/skip.rs (+427 -0)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemWireOracle.java (+155 -0)
➕ tools/test_item_wire_parity.py (+177 -0)

📄 Description

🤖 Opened by some-du6e's AI agent (Claude Code, Claude Opus 5.5), not by some-du6e themselves.

What and why

On a real Paper server, the inventory was empty until each slot was clicked, the advancements screen was blank, and the recipe book was missing. The log explained it:

skipped undecodable packet recipe_book_add: unsupported item component 55
skipped undecodable packet container_set_content: unsupported item component 58
skipped undecodable packet update_advancements: unsupported item component 74 / 76

Item data on the wire has no length prefix. A single component Horizon can't read (here a stew's effects, an armour trim, banner patterns or pot sherds) makes the whole packet undecodable, so one trimmed chestplate threw away the entire inventory.

This PR reads every one of the 122 data component types in 26.3. The components Horizon doesn't interpret are read past with their exact stream codec and stored as Component::Raw bytes, which are written back unchanged. On the client they're skipped, so the item keeps its prototype's value. This only makes the packets decodable: rendering a trim, for example, is a follow-up PR.

Vanilla reference

DataComponents (each type's networkSynchronized codec, or its persistent codec through ByteBufCodecs.fromCodecWithRegistries when it has none), DataComponentPatch.STREAM_CODEC, ItemStack.OPTIONAL_STREAM_CODEC, and the ByteBufCodecs primitives (holder, holderSet, optional, list, map).

New harness item_wire: tools/test_item_wire_parity.py + VanillaItemWireOracle + examples/item_wire_probe.rs. The oracle encodes 374 stacks with the real 26.3 jar: every distinct default component value of every item (set on a stick so it's in the patch), about 75 SNBT fixtures, and stacks built in Java (direct holders, non-persistent components, removals). The probe has to consume every byte, find the same component ids, and re-encode every read-past stack byte for byte. All 122 ids are covered; a deliberately broken skip reader is caught.

Self-check

pr_ready (tools/pr_ready.py --quick on swiss, against origin/main at 7fca3c2f9, 9 min 25 s)

Check Result
Scope ⚠️ 7 files, +871 −3; 542 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 287 passed (33 s)
rustfmt ✅ (8 s)
clippy ✅ (2 min 29 s)
tests: horizon-client, horizon-protocol ✅ 1257 passed (6 min 6 s)
doc tests ✅ 0 passed (7 s)
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)

Tested on that server: the inventory and advancements load (the recipe book packet decodes too, by the same fix).

Note

Filed by Claude Opus 5.5 using Claude Code, for some-du6e.

🤖 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/1631 **Author:** [@some-du6e](https://github.com/some-du6e) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/item-components` --- ### 📝 Commits (1) - [`9223b40`](https://github.com/horizon-rust/horizon/commit/9223b401e7bb8864711e1f05c891b9d3187bbadb) Decode every item data component a server sends ### 📊 Changes **7 files changed** (+871 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+2 -0) 📝 `crates/horizon-protocol/Cargo.toml` (+4 -0) ➕ `crates/horizon-protocol/examples/item_wire_probe.rs` (+64 -0) 📝 `crates/horizon-protocol/src/item.rs` (+42 -3) ➕ `crates/horizon-protocol/src/item/skip.rs` (+427 -0) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaItemWireOracle.java` (+155 -0) ➕ `tools/test_item_wire_parity.py` (+177 -0) </details> ### 📄 Description > 🤖 Opened by some-du6e's AI agent (Claude Code, Claude Opus 5.5), not by some-du6e themselves. ## What and why On a real Paper server, the inventory was empty until each slot was clicked, the advancements screen was blank, and the recipe book was missing. The log explained it: ``` skipped undecodable packet recipe_book_add: unsupported item component 55 skipped undecodable packet container_set_content: unsupported item component 58 skipped undecodable packet update_advancements: unsupported item component 74 / 76 ``` Item data on the wire has no length prefix. A single component Horizon can't read (here a stew's effects, an armour trim, banner patterns or pot sherds) makes the whole packet undecodable, so one trimmed chestplate threw away the entire inventory. This PR reads every one of the 122 data component types in 26.3. The components Horizon doesn't interpret are read past with their exact stream codec and stored as `Component::Raw` bytes, which are written back unchanged. On the client they're skipped, so the item keeps its prototype's value. This only makes the packets decodable: rendering a trim, for example, is a follow-up PR. ## Vanilla reference `DataComponents` (each type's `networkSynchronized` codec, or its persistent codec through `ByteBufCodecs.fromCodecWithRegistries` when it has none), `DataComponentPatch.STREAM_CODEC`, `ItemStack.OPTIONAL_STREAM_CODEC`, and the `ByteBufCodecs` primitives (`holder`, `holderSet`, `optional`, `list`, `map`). New harness `item_wire`: `tools/test_item_wire_parity.py` + `VanillaItemWireOracle` + `examples/item_wire_probe.rs`. The oracle encodes 374 stacks with the real 26.3 jar: every distinct default component value of every item (set on a stick so it's in the patch), about 75 SNBT fixtures, and stacks built in Java (direct holders, non-persistent components, removals). The probe has to consume every byte, find the same component ids, and re-encode every read-past stack byte for byte. All 122 ids are covered; a deliberately broken skip reader is caught. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on swiss, against origin/main at 7fca3c2f9, 9 min 25 s) | Check | Result | | --- | --- | | Scope | ⚠️ 7 files, +871 −3; 542 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 287 passed (33 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (2 min 29 s) | | tests: horizon-client, horizon-protocol | ✅ 1257 passed (6 min 6 s) | | doc tests | ✅ 0 passed (7 s) | | 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) | Tested on that server: the inventory and advancements load (the recipe book packet decodes too, by the same fix). > [!NOTE] > Filed by Claude Opus 5.5 using Claude Code, for some-du6e. 🤖 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 04:11: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#3647
No description provided.