From 66607c9eab9a313542e2a149446519b15d55a68f Mon Sep 17 00:00:00 2001 From: masa-masa-0314 <348336850+masa-masa-0314@users.noreply.github.com> Date: Tue, 27 Oct 2026 06:14:36 +0800 Subject: [PATCH] Items: glint enchanted armour on armour stands ArmorStandRenderer draws worn armour through the same HumanoidArmorLayer as a living entity, so its pieces should use the armour glint when ItemStack.hasFoil() is true. The stand's equipment loop now checks the stack's enchantment_glint_override component, then the item's default override, then its enchantments component (vanilla's Item.isFoil), and draws both the armour and its trim layer with overlay 13. The existing ARMOR_GLINT path supplies the model UV and samples enchanted_glint_armor through ARMOR_ENTITY_GLINT_TEXTURING. Co-Authored-By: ZCode --- crates/horizon-client/src/game/armor_stands.rs | 18 ++++++++++++++++-- crates/horizon-client/src/item_data.rs | 13 +++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/game/armor_stands.rs b/crates/horizon-client/src/game/armor_stands.rs index 92080b70c..dd81ac427 100644 --- a/crates/horizon-client/src/game/armor_stands.rs +++ b/crates/horizon-client/src/game/armor_stands.rs @@ -706,6 +706,20 @@ impl Game<'_> { let color = undyed.map_or(0xFFFF_FFFF, |c| { 0xFF00_0000 | (c & 0xFF) << 16 | (c & 0xFF00) | (c >> 16) & 0xFF }); + // ArmorStandRenderer's HumanoidArmorLayer: the armour glint + // when `stack.hasFoil()`, as on a living entity. + let item_glint = self + .res + .items() + .enchantments + .props + .get(&stack.item) + .is_some_and(|p| p.glint); + let overlay = if stack.has_foil(item_glint) { + horizon_client::mobs::render::ARMOR_GLINT + } else { + 0 + }; let layer_poses = Poses::new(part); horizon_client::mobs::render::draw( part, @@ -714,7 +728,7 @@ impl Game<'_> { uv, color, packed, - 0, + overlay, out, ); // EquipmentLayerRenderer: the trim layer over the armour. @@ -729,7 +743,7 @@ impl Game<'_> { trim, 0xFFFF_FFFF, packed, - 0, + overlay, out, ); } diff --git a/crates/horizon-client/src/item_data.rs b/crates/horizon-client/src/item_data.rs index ac624e85b..7499de7e4 100644 --- a/crates/horizon-client/src/item_data.rs +++ b/crates/horizon-client/src/item_data.rs @@ -198,6 +198,19 @@ impl ItemStack { pub fn has_any_enchantments(&self) -> bool { !self.enchantments().is_empty() || !self.stored_enchantments().is_empty() } + /// `ItemStack.hasFoil`: an explicit `minecraft:enchantment_glint_override` + /// component wins, then the item's default override (`item_glint`), then a + /// non-empty `minecraft:enchantments` component (`Item.isFoil` is + /// `ItemStack.isEnchanted`; stored book enchantments do not count). + pub fn has_foil(&self, item_glint: bool) -> bool { + if let Some(Tag::Byte(flag)) = self + .data() + .and_then(|d| d.other("minecraft:enchantment_glint_override")) + { + return *flag != 0; + } + item_glint || !self.enchantments().is_empty() + } pub fn repair_cost(&self) -> u32 { self.data().map_or(0, |d| d.repair_cost) }