[PR #3062] [MERGED] Show banner patterns on shields sent by a server, and hold items on a slim arm's middle #4775

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

📋 Pull Request Information

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

Base: main ← Head: fix/shield-arm-and-banner


📝 Commits (2)

  • e1bc2cb Show banner patterns on shields sent by a server
  • 99008ba Hold items at the middle of a slim arm

📊 Changes

4 files changed (+111 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/item_sync.rs (+27 -0)
📝 crates/horizon-client/src/lan/guest.rs (+38 -0)
📝 crates/horizon-client/src/mobs/render.rs (+4 -0)
📝 crates/horizon-protocol/src/item.rs (+42 -0)

📄 Description

What and why

  • Players on a server saw every shield plain, with no banner pattern, even when it had one. In the inventory and the hotbar too, not only in third person.
  • Cause: the minecraft:banner_patterns (id 74) and minecraft:base_color (id 75) components were read past on the wire (Component::Raw) and dropped when the stack was turned into an ItemStack (item_sync::components_tag skips Raw). The stack from a server never had the layers or the dye, so the shield special renderer, which already draws both correctly, got an empty argument. Single player has the same wire path through the in-process server, and its stack encoder (lan::guest::network_stack) did not write the two components either.
  • Change, horizon-protocol/src/item.rs: BASE_COLOR is read as the dye id, BANNER_PATTERNS as Component::BannerPatterns(Vec<(pattern id, dye id)>) when every layer's pattern is a registry reference. A layer with a direct pattern keeps the whole value Raw, so its bytes still go back unchanged (the existing components_read_past_keep_their_bytes vector for id 74 has a direct layer and stays Raw). Both are written back byte for byte.
  • Change, item_sync.rs: the pattern id is named through the synced minecraft:banner_pattern registry and the dye id through DYES, giving the same components NBT the save and command decoders already read. If a pattern id is unknown the component is left out, as for a trim.
  • Change, lan/guest.rs: network_stack writes the patterns (names to ids through the synced registry) and the base colour.
  • Second commit: the item in a slim player's hand was placed for the wide arm. Vanilla's PlayerModel.translateToHand moves the arm by 0.5 toward the hand for slim arms before the item's offset, as SkeletonModel does by 1. hand_base now does the same for slim players and mannequins. This is a half-pixel alignment fix I found while checking the shield's hold, not the cause of the missing arm below.
  • Not fixed, from the same report: the player model missing the shield-side arm. I could not find a code path that hides the arm. Nothing in the Horizon draw path hides a player's arm (Poses::visible and skip_draw are not called for players), the player and slim models both contain both arms and sleeves, the armour parts draw both arms, and I found no NaN or zero scale in the pose code. One case that looks like a missing arm and is vanilla: while the shield is being used (BLOCK pose) the left arm is raised and turned 30 degrees across the chest, so from behind it is mostly hidden by the torso and the shield is left beside the body. If the player was not blocking, this needs a game run. Candidate places: mobs/anim.rs pose_arm and humanoid for the off-hand pose, perspective.rs tick_player_model (blocking, using_off_hand), mobs/render.rs draw_normals (the per-part is_hidden and zero-scale skips).
  • Not covered: the shield another player holds. Other players' hands are kept as item names (mob.extra.off_hand), and mob_blocks.rs held_item_geometry builds a bare ItemStack::new(item, 1) for them, so their shields draw without a pattern. That needs the equipment stacks kept per mob and is a separate change.

Vanilla reference

  • BannerPatternLayers.java:30 (STREAM_CODEC: a list of layers) and :86 (Layer.STREAM_CODEC: pattern holder, then dye)
  • BannerPattern.java:21 (DIRECT_STREAM_CODEC) and :25 (STREAM_CODEC: ByteBufCodecs.holder, a reference is its id plus one, 0 then the value for a direct one)
  • DyeColor.java:53 (STREAM_CODEC: idMapper, out of range is id 0)
  • DataComponents.java:321 and :324 (BANNER_PATTERNS and BASE_COLOR are network synchronized)
  • ShieldSpecialRenderer.java:39 (extractArgument takes the stack's components) and :53, :55 (reads BANNER_PATTERNS and BASE_COLOR)
  • PlayerModel.java:126 (translateToHand, the slim 0.5 shift)
  • HumanoidModel.java:437 (poseBlockingArm)

Self-check

fmt passes. Built and tested by this pull request's checks. Not run in game.


🔄 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/3062 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/shield-arm-and-banner` --- ### 📝 Commits (2) - [`e1bc2cb`](https://github.com/horizon-rust/horizon/commit/e1bc2cbea323359ff8d80853c09e4d112f161870) Show banner patterns on shields sent by a server - [`99008ba`](https://github.com/horizon-rust/horizon/commit/99008baad9430641c9e6c707236caed6bf536814) Hold items at the middle of a slim arm ### 📊 Changes **4 files changed** (+111 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/item_sync.rs` (+27 -0) 📝 `crates/horizon-client/src/lan/guest.rs` (+38 -0) 📝 `crates/horizon-client/src/mobs/render.rs` (+4 -0) 📝 `crates/horizon-protocol/src/item.rs` (+42 -0) </details> ### 📄 Description ## What and why - Players on a server saw every shield plain, with no banner pattern, even when it had one. In the inventory and the hotbar too, not only in third person. - Cause: the `minecraft:banner_patterns` (id 74) and `minecraft:base_color` (id 75) components were read past on the wire (`Component::Raw`) and dropped when the stack was turned into an `ItemStack` (`item_sync::components_tag` skips `Raw`). The stack from a server never had the layers or the dye, so the shield special renderer, which already draws both correctly, got an empty argument. Single player has the same wire path through the in-process server, and its stack encoder (`lan::guest::network_stack`) did not write the two components either. - Change, `horizon-protocol/src/item.rs`: `BASE_COLOR` is read as the dye id, `BANNER_PATTERNS` as `Component::BannerPatterns(Vec<(pattern id, dye id)>)` when every layer's pattern is a registry reference. A layer with a direct pattern keeps the whole value `Raw`, so its bytes still go back unchanged (the existing `components_read_past_keep_their_bytes` vector for id 74 has a direct layer and stays `Raw`). Both are written back byte for byte. - Change, `item_sync.rs`: the pattern id is named through the synced `minecraft:banner_pattern` registry and the dye id through `DYES`, giving the same `components` NBT the save and command decoders already read. If a pattern id is unknown the component is left out, as for a trim. - Change, `lan/guest.rs`: `network_stack` writes the patterns (names to ids through the synced registry) and the base colour. - Second commit: the item in a slim player's hand was placed for the wide arm. Vanilla's `PlayerModel.translateToHand` moves the arm by 0.5 toward the hand for slim arms before the item's offset, as `SkeletonModel` does by 1. `hand_base` now does the same for slim players and mannequins. This is a half-pixel alignment fix I found while checking the shield's hold, not the cause of the missing arm below. - Not fixed, from the same report: the player model missing the shield-side arm. I could not find a code path that hides the arm. Nothing in the Horizon draw path hides a player's arm (`Poses::visible` and `skip_draw` are not called for players), the player and slim models both contain both arms and sleeves, the armour parts draw both arms, and I found no NaN or zero scale in the pose code. One case that looks like a missing arm and is vanilla: while the shield is being used (BLOCK pose) the left arm is raised and turned 30 degrees across the chest, so from behind it is mostly hidden by the torso and the shield is left beside the body. If the player was not blocking, this needs a game run. Candidate places: `mobs/anim.rs` `pose_arm` and `humanoid` for the off-hand pose, `perspective.rs` `tick_player_model` (`blocking`, `using_off_hand`), `mobs/render.rs` `draw_normals` (the per-part `is_hidden` and zero-scale skips). - Not covered: the shield another player holds. Other players' hands are kept as item names (`mob.extra.off_hand`), and `mob_blocks.rs` `held_item_geometry` builds a bare `ItemStack::new(item, 1)` for them, so their shields draw without a pattern. That needs the equipment stacks kept per mob and is a separate change. ## Vanilla reference - `BannerPatternLayers.java:30` (`STREAM_CODEC`: a list of layers) and `:86` (`Layer.STREAM_CODEC`: pattern holder, then dye) - `BannerPattern.java:21` (`DIRECT_STREAM_CODEC`) and `:25` (`STREAM_CODEC`: `ByteBufCodecs.holder`, a reference is its id plus one, 0 then the value for a direct one) - `DyeColor.java:53` (`STREAM_CODEC`: `idMapper`, out of range is id 0) - `DataComponents.java:321` and `:324` (`BANNER_PATTERNS` and `BASE_COLOR` are network synchronized) - `ShieldSpecialRenderer.java:39` (`extractArgument` takes the stack's components) and `:53`, `:55` (reads `BANNER_PATTERNS` and `BASE_COLOR`) - `PlayerModel.java:126` (`translateToHand`, the slim 0.5 shift) - `HumanoidModel.java:437` (`poseBlockingArm`) ## Self-check fmt passes. Built and tested by this pull request's checks. Not run in game. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:51 +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#4775
No description provided.