From 6823e34451a60971cddc1851e68f8ef485a5dcbb Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Mon, 26 Oct 2026 19:12:31 +0100 Subject: [PATCH] Let a piglin let go of the gold it admires when a player hits it --- crates/horizon-client/src/mobs/ai.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/horizon-client/src/mobs/ai.rs b/crates/horizon-client/src/mobs/ai.rs index 2676c3a37..eab3d486f 100644 --- a/crates/horizon-client/src/mobs/ai.rs +++ b/crates/horizon-client/src/mobs/ai.rs @@ -1328,7 +1328,16 @@ pub fn after_hurt(m: &mut Mob, source: &Damage) { // PiglinAi.wasHurtBy: drop what is being admired, no admiring for // a while after a player's hit, and anger. Species::Piglin if source.attacker == Some(Who::Player) => { - m.extra.using_item = 0; + // stopHoldingOffHandItem(.., false): a gold ingot is not bartered + // and is gone; anything else ends its admiring next tick, as if + // the time ran out, and the game side puts it away. + if m.extra.off_hand.as_deref() == Some("minecraft:gold_ingot") { + m.extra.off_hand = None; + m.extra.using_item = 0; + } else { + m.extra.using_item = + i32::from(m.extra.off_hand.is_some() && m.extra.using_item > 0); + } m.extra.egg_time = 400; m.extra.anger = 600; }