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) }