[PR #6358] [MERGED] OptiFine CIT: worn armour and elytra wear their pack's textures #6823

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6358
Author: @some-du6e
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: optifine/cit-armor


📝 Commits (10+)

  • bea7d2d OptiFine CIT: items draw their pack's texture or model
  • 608545c OptiFine CIT: worn armour and elytra wear their pack's textures
  • f605856 OptiFine CIT: pack armour and elytra textures with the rest
  • e78f536 Merge branch 'optifine/cit-overlay' into optifine/cit-items
  • 19327fd Merge branch 'optifine/cit-items' into optifine/cit-armor
  • 123bd3f OptiFine CIT: item swap tests keep their files until the sprites are baked
  • 6fb7637 Merge branch 'optifine/cit-overlay' into optifine/cit-items
  • d4080d5 Merge branch 'optifine/cit-items' into optifine/cit-armor
  • bc1f509 Merge branch 'optifine/cit-overlay' into optifine/cit-items
  • a7d1142 Merge branch 'optifine/cit-items' into optifine/cit-armor

📊 Changes

14 files changed (+1510 additions, -52 deletions)

View changed files

📝 crates/horizon-assets/src/resolve.rs (+39 -0)
➕ crates/horizon-client-render/src/cit_armor.rs (+319 -0)
📝 crates/horizon-client-render/src/cit_assets.rs (+184 -6)
📝 crates/horizon-client-render/src/hud.rs (+39 -9)
📝 crates/horizon-client-render/src/lib.rs (+1 -0)
📝 crates/horizon-client/src/client_lib.rs (+2 -2)
📝 crates/horizon-client/src/game.rs (+6 -1)
📝 crates/horizon-client/src/game/armor_stands.rs (+36 -11)
📝 crates/horizon-client/src/game/item_draw.rs (+25 -1)
📝 crates/horizon-client/src/game/mob_blocks.rs (+6 -1)
📝 crates/horizon-client/src/game/perspective.rs (+11 -7)
📝 crates/horizon-client/src/item_render.rs (+43 -13)
➕ crates/horizon-client/src/item_render/cit.rs (+797 -0)
📝 docs/resource-packs.md (+2 -1)

📄 Description

OptiFine and CIT Resewn packs also re-skin worn armour and elytra by the stack's name, enchantments or components (type=armor, type=elytra), for example a renamed diamond chestplate that looks like dragon scale. After #6334, items in hand and in the GUI draw their CIT texture, but worn armour and elytra still looked vanilla. This PR draws them.

This PR builds on #6334 (and the PRs under it). GitHub shows their commits too. This PR's own changes are cit_armor.rs (new), worn_rule in item_render/cit.rs, the shared rule_sprites in cit_assets.rs, game/armor_stands.rs, game/perspective.rs, the armour line in hud.rs, the re-export, and the CIT row of docs/resource-packs.md.

What players get:

  • Armour: the worn armour of the local player, other players, LAN guests and armour stands uses the matching type=armor rule's textures.
    • texture.<layer> keys use OptiFine's old file names: diamond_layer_1 for the helmet, chestplate and boots, diamond_layer_2 for leggings, and leather_layer_1_overlay for the dye overlay. Horizon maps them onto 26.x's equipment layers (humanoid/diamond, humanoid_leggings/diamond, leather_overlay; turtle_scute is turtle).
    • A bare texture covers any layer, as OptiFine's doc says.
    • The rule is chosen per worn stack, so a renamed or enchanted piece can differ from a plain one. Damage rules read the stack's own max_damage component, as items in hand do, and worn pieces count as the main hand for hand=, as in OptiFine.
    • A bare texture also covers leather's dye overlay layer, as OptiFine's doc words it ("if no texture. property is matching, the generic texture will be used"); packs that want the dye to show name texture.leather_layer_1_overlay.
  • Elytra: a matching type=elytra rule's texture replaces the wing texture for players and armour stands. It wins over a cape-shaped elytra, as in OptiFine.
  • Atlas: armour and elytra textures are packed with the item textures, whole (2:1 layers are not cut square).
  • Armour stands' off-hand item now matches hand=off item rules, completing #6334's hands.
  • Without CIT rules nothing changes: no lookup when the renderer has no rules. If a rule's texture isn't in the atlas, the vanilla layer is drawn.

Not yet: armour textures above 1024x512 (16 times vanilla's 64x32) draw vanilla, as every atlas texture over that size does. Zombies, skeletons and other non-player mobs keep vanilla armour and elytra. Their armour is drawn in the client lib, which can't reach the rules from there; that's a follow-up. Worn armour trims are unchanged.

Tests (hand-computed answers):

  • cit_armor maps every equipment asset to its old layer name (gold and turtle_scute included, and leggings and overlays);
  • the worn layer's sprite: leather layer 1 and its overlay, leggings on _layer_2, none for a layer the rule doesn't name or no rule (the bin then draws vanilla, or vanilla when the atlas lacks the rule's texture);
  • wings: the rule's texture;
  • the atlas lookup the bin calls: the rule's sprite, else vanilla's layer when the atlas lacks it or there is no rule; wings: the rule's, else the cape;
  • the worn rule counts as the main hand (hand=main armour rules match, hand=off ones don't), and its damage=% test reads the stack's own max_damage component;
  • texture.<layer> wins over texture;
  • armour and elytra rules' textures become atlas sprite ids (both texture and texture.<layer>), and item and enchantment rules' don't;
  • the atlas packs an armour rule's 64x32 texture at 64x32, under the name the worn layer looks up.

Also updated: the CIT row of docs/resource-packs.md.

Docs used: OptiFine's cit_single.properties ("Armor") and CIT Resewn's wiki (CIT Armor, CIT Elytra). No mod code was read for this PR.

Checks:

Note

Filed by Opus 5.5 using 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/6358 **Author:** [@some-du6e](https://github.com/some-du6e) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `optifine/cit-armor` --- ### 📝 Commits (10+) - [`bea7d2d`](https://github.com/horizon-rust/horizon/commit/bea7d2d0fb614afb81cf29e7c93b3ec521d379a0) OptiFine CIT: items draw their pack's texture or model - [`608545c`](https://github.com/horizon-rust/horizon/commit/608545c23e3a3e891bb26638dc86bc967b1da66d) OptiFine CIT: worn armour and elytra wear their pack's textures - [`f605856`](https://github.com/horizon-rust/horizon/commit/f6058569cb45f1e8ae8d450c4a9fc7dafecb8dec) OptiFine CIT: pack armour and elytra textures with the rest - [`e78f536`](https://github.com/horizon-rust/horizon/commit/e78f5366c7beb213a0debd369c39a6768c6bae9f) Merge branch 'optifine/cit-overlay' into optifine/cit-items - [`19327fd`](https://github.com/horizon-rust/horizon/commit/19327fd08f85fccaedff4758797a4a5307860c50) Merge branch 'optifine/cit-items' into optifine/cit-armor - [`123bd3f`](https://github.com/horizon-rust/horizon/commit/123bd3ff7a01b5c4d75f54e9ed335fdb155f078d) OptiFine CIT: item swap tests keep their files until the sprites are baked - [`6fb7637`](https://github.com/horizon-rust/horizon/commit/6fb7637cf1cabf64f4ea75ea064b23f893c3513f) Merge branch 'optifine/cit-overlay' into optifine/cit-items - [`d4080d5`](https://github.com/horizon-rust/horizon/commit/d4080d5d7fc69f262c71d7f780f7e8413c57abfc) Merge branch 'optifine/cit-items' into optifine/cit-armor - [`bc1f509`](https://github.com/horizon-rust/horizon/commit/bc1f50970fa2a6f7d70fd80fcedcb2f277f1aa6f) Merge branch 'optifine/cit-overlay' into optifine/cit-items - [`a7d1142`](https://github.com/horizon-rust/horizon/commit/a7d11428c2e248e5f458c204941c2911523fcf9d) Merge branch 'optifine/cit-items' into optifine/cit-armor ### 📊 Changes **14 files changed** (+1510 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-assets/src/resolve.rs` (+39 -0) ➕ `crates/horizon-client-render/src/cit_armor.rs` (+319 -0) 📝 `crates/horizon-client-render/src/cit_assets.rs` (+184 -6) 📝 `crates/horizon-client-render/src/hud.rs` (+39 -9) 📝 `crates/horizon-client-render/src/lib.rs` (+1 -0) 📝 `crates/horizon-client/src/client_lib.rs` (+2 -2) 📝 `crates/horizon-client/src/game.rs` (+6 -1) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+36 -11) 📝 `crates/horizon-client/src/game/item_draw.rs` (+25 -1) 📝 `crates/horizon-client/src/game/mob_blocks.rs` (+6 -1) 📝 `crates/horizon-client/src/game/perspective.rs` (+11 -7) 📝 `crates/horizon-client/src/item_render.rs` (+43 -13) ➕ `crates/horizon-client/src/item_render/cit.rs` (+797 -0) 📝 `docs/resource-packs.md` (+2 -1) </details> ### 📄 Description OptiFine and CIT Resewn packs also re-skin worn armour and elytra by the stack's name, enchantments or components (`type=armor`, `type=elytra`), for example a renamed diamond chestplate that looks like dragon scale. After #6334, items in hand and in the GUI draw their CIT texture, but worn armour and elytra still looked vanilla. This PR draws them. **This PR builds on #6334** (and the PRs under it). GitHub shows their commits too. This PR's own changes are `cit_armor.rs` (new), `worn_rule` in `item_render/cit.rs`, the shared `rule_sprites` in `cit_assets.rs`, `game/armor_stands.rs`, `game/perspective.rs`, the armour line in `hud.rs`, the re-export, and the CIT row of `docs/resource-packs.md`. What players get: - **Armour:** the worn armour of the local player, other players, LAN guests and armour stands uses the matching `type=armor` rule's textures. - `texture.<layer>` keys use OptiFine's old file names: `diamond_layer_1` for the helmet, chestplate and boots, `diamond_layer_2` for leggings, and `leather_layer_1_overlay` for the dye overlay. Horizon maps them onto 26.x's equipment layers (`humanoid/diamond`, `humanoid_leggings/diamond`, `leather_overlay`; `turtle_scute` is `turtle`). - A bare `texture` covers any layer, as OptiFine's doc says. - The rule is chosen per worn stack, so a renamed or enchanted piece can differ from a plain one. Damage rules read the stack's own `max_damage` component, as items in hand do, and worn pieces count as the main hand for `hand=`, as in OptiFine. - A bare `texture` also covers leather's dye overlay layer, as OptiFine's doc words it ("if no texture.<name> property is matching, the generic texture will be used"); packs that want the dye to show name `texture.leather_layer_1_overlay`. - **Elytra:** a matching `type=elytra` rule's `texture` replaces the wing texture for players and armour stands. It wins over a cape-shaped elytra, as in OptiFine. - **Atlas:** armour and elytra textures are packed with the item textures, whole (2:1 layers are not cut square). - **Armour stands' off-hand item** now matches `hand=off` item rules, completing #6334's hands. - **Without CIT rules nothing changes:** no lookup when the renderer has no rules. If a rule's texture isn't in the atlas, the vanilla layer is drawn. Not yet: armour textures above 1024x512 (16 times vanilla's 64x32) draw vanilla, as every atlas texture over that size does. Zombies, skeletons and other non-player mobs keep vanilla armour and elytra. Their armour is drawn in the client lib, which can't reach the rules from there; that's a follow-up. Worn armour trims are unchanged. **Tests** (hand-computed answers): - `cit_armor` maps every equipment asset to its old layer name (`gold` and `turtle_scute` included, and leggings and overlays); - the worn layer's sprite: leather layer 1 and its overlay, leggings on `_layer_2`, none for a layer the rule doesn't name or no rule (the bin then draws vanilla, or vanilla when the atlas lacks the rule's texture); - wings: the rule's texture; - the atlas lookup the bin calls: the rule's sprite, else vanilla's layer when the atlas lacks it or there is no rule; wings: the rule's, else the cape; - the worn rule counts as the main hand (`hand=main` armour rules match, `hand=off` ones don't), and its `damage=%` test reads the stack's own `max_damage` component; - `texture.<layer>` wins over `texture`; - armour and elytra rules' textures become atlas sprite ids (both `texture` and `texture.<layer>`), and item and enchantment rules' don't; - the atlas packs an armour rule's 64x32 texture at 64x32, under the name the worn layer looks up. Also updated: the CIT row of `docs/resource-packs.md`. **Docs used:** OptiFine's `cit_single.properties` ("Armor") and CIT Resewn's wiki (CIT Armor, CIT Elytra). No mod code was read for this PR. **Checks:** - `cargo fmt` - Fork CI (`verify`: workspace clippy `-D warnings` and every test) passed on this branch before the latest merge from #6334: https://github.com/some-du6e/horizon/actions/runs/41341292411. On the current head: https://github.com/some-du6e/horizon/actions/runs/41349389105 (`verify` passed) - Nothing was built locally: the machine is shared. - **The live game test was skipped:** there is no vanilla data (`.local/`) on this machine. Before merging, someone with it should check a renamed chestplate and an elytra in third person. > [!NOTE] > Filed by Opus 5.5 using 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 06:27:34 +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#6823
No description provided.