From 306c6625e90649544ecb3373c0126760076b1c67 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 06:33:07 +0100 Subject: [PATCH] Shear snow golems and bogged by hand and use vanilla's snowball spread --- crates/horizon-client/src/game/creatures.rs | 37 +++++++++++++++++++ .../horizon-client/src/game/remote_mob_use.rs | 2 + crates/horizon-client/src/mobs/golem.rs | 4 +- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/game/creatures.rs b/crates/horizon-client/src/game/creatures.rs index 2bc40a7af..059ee1c30 100644 --- a/crates/horizon-client/src/game/creatures.rs +++ b/crates/horizon-client/src/game/creatures.rs @@ -2857,6 +2857,10 @@ impl Game<'_> { self.swing_arm(); return Ok(true); } + if self.interact_shear_mob(index, &item) { + self.swing_arm(); + return Ok(true); + } // AbstractHorse.mobInteract: feed, equip or ride. if self.interact_mount(index, &item) { self.swing_arm(); @@ -3255,6 +3259,39 @@ impl Game<'_> { } Ok(true) } + /// `SnowGolem.mobInteract` and `Bogged.mobInteract` with shears: the + /// pumpkin or the mushrooms come off (the shearing loot table), the shear + /// game event is posted and the tool takes one damage. + fn interact_shear_mob(&mut self, index: usize, item: &str) -> bool { + let m = &self.mobs[index]; + if item != "minecraft:shears" || !m.alive() || m.extra.sheared { + return false; + } + let (sound, table, height) = match m.species() { + Species::SnowGolem => ( + "minecraft:entity.snow_golem.shear", + "minecraft:shearing/snow_golem", + m.eye_height(), + ), + Species::Bogged => ( + "minecraft:entity.bogged.shear", + "minecraft:shearing/bogged", + f64::from(m.height()), + ), + _ => return false, + }; + let at = m.position; + let tool = self.held().cloned(); + self.audio.play(sound, Some([at.x, at.y, at.z]), 1.0, 1.0); + self.mobs[index].extra.sheared = true; + for stack in self.sequence_loot(table, table, tool.as_ref()) { + self.spawn_at_location(at, height, stack); + } + let ctx = self.who_context(Some(horizon_client::mobs::Who::Player), None); + self.post_game_event("minecraft:shear", [at.x, at.y, at.z], ctx); + self.damage_held_tool(); + true + } pub(super) fn damage_held_tool(&mut self) { if self.creative { return; diff --git a/crates/horizon-client/src/game/remote_mob_use.rs b/crates/horizon-client/src/game/remote_mob_use.rs index 9575cf925..31b1c1ad2 100644 --- a/crates/horizon-client/src/game/remote_mob_use.rs +++ b/crates/horizon-client/src/game/remote_mob_use.rs @@ -61,6 +61,8 @@ impl Game<'_> { ) && !baby } Species::Sheep => item == "minecraft:shears" || item.ends_with("_dye"), + // SnowGolem.mobInteract: shears take the pumpkin off. + Species::SnowGolem => item == "minecraft:shears" && !m.extra.sheared, // Bucketable.bucketMobPickup. Species::Cod | Species::Salmon diff --git a/crates/horizon-client/src/mobs/golem.rs b/crates/horizon-client/src/mobs/golem.rs index c41c34f11..593b855c4 100644 --- a/crates/horizon-client/src/mobs/golem.rs +++ b/crates/horizon-client/src/mobs/golem.rs @@ -309,12 +309,12 @@ fn snowball_attack(m: &mut Mob, who: Who, _power: f32, cx: &mut Cx) { let zd = t.position.z - m.position.z; let yo = (xd * xd + zd * zd).sqrt() * 0.2; let mut p = Projectile::new(ProjectileKind::Snowball, start, Some(Who::Mob(m.id))); - // rangedAttackUncertainty: 14 - 4 * difficulty (normal: 6). + // SnowGolem.rangedAttackUncertainty: 12 on every difficulty. p.shoot( &mut crate::projectiles::own_random(m), [xd, yd + yo - start.y, zd], 1.6, - 6.0, + 12.0, ); cx.events.push(MobEvent::Projectile(p)); let pitch = 0.4 / (m.random.next_float() * 0.4 + 0.8);