[PR #1194] [MERGED] Armour trims on worn armour (player, LAN guests, armour stands) #3408

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1194
Author: @ludovic111
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @ludovic111

Base: main ← Head: feat/armour-trims-worn


📝 Commits (2)

  • c77863f Armour trims on worn armour (player, LAN guests, armour stands)
  • 901a5b8 Merge origin/main into feat/armour-trims-worn

📊 Changes

7 files changed (+553 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/game/armor_stands.rs (+175 -6)
📝 crates/horizon-client/src/game/lan.rs (+5 -2)
📝 crates/horizon-client/src/game/packs.rs (+1 -0)
📝 crates/horizon-client/src/hud.rs (+13 -2)
📝 crates/horizon-client/src/lib.rs (+1 -0)
➕ crates/horizon-client/src/trims.rs (+354 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

Armour trims now show on worn armour, as 26.3's EquipmentLayerRenderer draws them: after the armour layers, one more layer with the trim texture made by PalettedTextureManager.

  • trims.rs (new): TrimTextureKey.getOrPrepareTexture (the trim_pattern asset id under trims/entity/<layer>/, the trim_material palette_id, and the equipment asset's trim_overrides: iron armour with an iron trim uses trim/iron_darker, an override without a palette keeps the texture's own colours) and PalettedTextureManager.prepareSlot (PaletteMapping from the texture's palette metadata base palette to the target palette, reusing horizon_assets::palette::apply_palette; size mismatch or a missing palette = PaletteMapping.NONE).
  • HudAtlas reserves 32 trim slots, each the size of the largest trims/entity texture (64x32 in vanilla; HD packs get bigger slots). Game::prepare_trims makes each texture once, on first use, uploads it like downloaded skins (map_patches) and reuses the least recently drawn slot when they're all taken. A resource reload reloads the trim registries, overrides and palettes.
  • Drawn on the local player (third person, inventory preview), on the guests a LAN host sees (their real stacks) and on armour stands. HUMANOID_BABY isn't a layer Horizon draws, so the vanilla rule "no trim on baby layers" holds.

Fixes #337 (found by the resource pack audit, docs/resource-packs.md).

Screenshots (Mac mini, --offscreen, 1280x720, crops at 2x)

Diamond helmet + amethyst sentry, iron chestplate + gold coast, iron leggings + iron wild (iron_darker override), netherite boots + emerald rib:

With trims (this PR) Same armour, no trim component (what main draws for trimmed armour) Armour stand: chainmail + redstone eye, gold + diamond vex

Full frames: player, no trims. The vanilla client couldn't be captured beside it (the Mac mini session is locked); the colours come from the same palettes by the same mapping, which vanilla_trims_are_recoloured checks pixel by pixel against palettes/trim/gold.png.

How tested

  • cargo fmt --all --check: clean
  • cargo clippy --workspace --all-targets -- -D warnings (pipefail): exit 0
  • cargo test -p horizon-client: all pass (lib 987 passed, 15 ignored; bin 91 passed); new: material_palette_and_layer_folder, equipment_overrides_pick_the_darker_palette, vanilla_trims_are_recoloured
  • tools/parity.py --changed origin/main: result posted in a comment once the batch's integration run finishes

Not covered (noted in FEATURES.md LATER)

  • Mobs and players on a remote server keep only item ids for their equipment (Mob.extra.head...), so their trims don't show yet: the equipment packets' components need keeping first.
  • Decal trim patterns (decal: true, none in vanilla) draw like the others rather than with armor_decal_cutout_no_cull's EQUAL depth test; armour glint is still not drawn (so trimmedArmorGlint neither).

Nothing needs Ludovic.

🤖 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/1194 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/armour-trims-worn` --- ### 📝 Commits (2) - [`c77863f`](https://github.com/horizon-rust/horizon/commit/c77863f16314af2f891ee50c770b4ce158197cf4) Armour trims on worn armour (player, LAN guests, armour stands) - [`901a5b8`](https://github.com/horizon-rust/horizon/commit/901a5b8207bf611902c8f0f59ded8dcc6dd8fa1e) Merge origin/main into feat/armour-trims-worn ### 📊 Changes **7 files changed** (+553 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+175 -6) 📝 `crates/horizon-client/src/game/lan.rs` (+5 -2) 📝 `crates/horizon-client/src/game/packs.rs` (+1 -0) 📝 `crates/horizon-client/src/hud.rs` (+13 -2) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) ➕ `crates/horizon-client/src/trims.rs` (+354 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Armour trims now show on worn armour, as 26.3's `EquipmentLayerRenderer` draws them: after the armour layers, one more layer with the trim texture made by `PalettedTextureManager`. - `trims.rs` (new): `TrimTextureKey.getOrPrepareTexture` (the `trim_pattern` asset id under `trims/entity/<layer>/`, the `trim_material` `palette_id`, and the equipment asset's `trim_overrides`: iron armour with an iron trim uses `trim/iron_darker`, an override without a palette keeps the texture's own colours) and `PalettedTextureManager.prepareSlot` (`PaletteMapping` from the texture's `palette` metadata base palette to the target palette, reusing `horizon_assets::palette::apply_palette`; size mismatch or a missing palette = `PaletteMapping.NONE`). - `HudAtlas` reserves 32 trim slots, each the size of the largest `trims/entity` texture (64x32 in vanilla; HD packs get bigger slots). `Game::prepare_trims` makes each texture once, on first use, uploads it like downloaded skins (`map_patches`) and reuses the least recently drawn slot when they're all taken. A resource reload reloads the trim registries, overrides and palettes. - Drawn on the local player (third person, inventory preview), on the guests a LAN host sees (their real stacks) and on armour stands. `HUMANOID_BABY` isn't a layer Horizon draws, so the vanilla rule "no trim on baby layers" holds. Fixes #337 (found by the resource pack audit, docs/resource-packs.md). ## Screenshots (Mac mini, `--offscreen`, 1280x720, crops at 2x) Diamond helmet + amethyst sentry, iron chestplate + gold coast, iron leggings + iron wild (`iron_darker` override), netherite boots + emerald rib: | With trims (this PR) | Same armour, no trim component (what main draws for trimmed armour) | Armour stand: chainmail + redstone eye, gold + diamond vex | |---|---|---| | ![](https://raw.githubusercontent.com/ludovic111/horizon/f386be8dd1205c0ed8f9a86052e62fe99e18f84e/337/zoom-player-trims.png) | ![](https://raw.githubusercontent.com/ludovic111/horizon/f386be8dd1205c0ed8f9a86052e62fe99e18f84e/337/zoom-player-no-trims.png) | ![](https://raw.githubusercontent.com/ludovic111/horizon/f386be8dd1205c0ed8f9a86052e62fe99e18f84e/337/zoom-armor-stand.png) | Full frames: [player](https://raw.githubusercontent.com/ludovic111/horizon/f386be8dd1205c0ed8f9a86052e62fe99e18f84e/337/player-trims.png), [no trims](https://raw.githubusercontent.com/ludovic111/horizon/f386be8dd1205c0ed8f9a86052e62fe99e18f84e/337/player-no-trims.png). The vanilla client couldn't be captured beside it (the Mac mini session is locked); the colours come from the same palettes by the same mapping, which `vanilla_trims_are_recoloured` checks pixel by pixel against `palettes/trim/gold.png`. ## How tested - `cargo fmt --all --check`: clean - `cargo clippy --workspace --all-targets -- -D warnings` (pipefail): exit 0 - `cargo test -p horizon-client`: all pass (lib 987 passed, 15 ignored; bin 91 passed); new: `material_palette_and_layer_folder`, `equipment_overrides_pick_the_darker_palette`, `vanilla_trims_are_recoloured` - `tools/parity.py --changed origin/main`: result posted in a comment once the batch's integration run finishes ## Not covered (noted in FEATURES.md LATER) - Mobs and players on a remote server keep only item ids for their equipment (`Mob.extra.head`...), so their trims don't show yet: the equipment packets' components need keeping first. - Decal trim patterns (`decal: true`, none in vanilla) draw like the others rather than with `armor_decal_cutout_no_cull`'s EQUAL depth test; armour glint is still not drawn (so `trimmedArmorGlint` neither). Nothing needs Ludovic. 🤖 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:09:18 +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#3408
No description provided.