From 6c3defa821dd767413e421b5ada81759f83a47b5 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:16:09 +0100 Subject: [PATCH 1/9] Hit with a hoglin or zoglin every 40 ticks, 15 for a baby HoglinAi and Zoglin use MeleeAttack.create(40) for adults and create(15) for babies; Horizon used the 20-tick default. --- crates/horizon-client/src/mobs/goals.rs | 15 ++++++++++++++- crates/horizon-client/src/mobs/piglin.rs | 6 ++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/crates/horizon-client/src/mobs/goals.rs b/crates/horizon-client/src/mobs/goals.rs index e4682b0de..8a72c1e8a 100644 --- a/crates/horizon-client/src/mobs/goals.rs +++ b/crates/horizon-client/src/mobs/goals.rs @@ -1065,6 +1065,8 @@ pub struct MeleeAttack { raise_arm: i32, /// Ticks between attacks (20 unless set). pub interval: i32, + /// Ticks between attacks for a baby, when they differ. + pub baby_interval: Option, } impl MeleeAttack { pub fn new(speed: f64, follow_unseen: bool) -> Self { @@ -1079,6 +1081,7 @@ impl MeleeAttack { last_check: 0, raise_arm: 0, interval: 20, + baby_interval: None, } } pub fn zombie(mut self) -> Self { @@ -1093,6 +1096,12 @@ impl MeleeAttack { self.interval = ticks; self } + /// `MeleeAttack.create(adult)` for adults, `create(baby)` for babies. + pub fn intervals(mut self, adult: i32, baby: i32) -> Self { + self.interval = adult; + self.baby_interval = Some(baby); + self + } } impl Goal for MeleeAttack { goal_clone!(); @@ -1191,7 +1200,11 @@ impl Goal for MeleeAttack { cx, ); } else if self.until_attack <= 0 && m.within_melee_range(&t) && m.sees(cx.w, who) { - self.until_attack = adjusted(true, self.interval); + let interval = match self.baby_interval { + Some(baby) if m.is_baby() => baby, + _ => self.interval, + }; + self.until_attack = adjusted(true, interval); m.swing(); super::ai::do_hurt_target(m, who, cx); } diff --git a/crates/horizon-client/src/mobs/piglin.rs b/crates/horizon-client/src/mobs/piglin.rs index aaaaf4dda..aa6d7bb09 100644 --- a/crates/horizon-client/src/mobs/piglin.rs +++ b/crates/horizon-client/src/mobs/piglin.rs @@ -169,7 +169,8 @@ pub fn register_hoglin(m: &mut Mob) { let g = &mut m.ai.goals; g.add(0, Float); g.add(1, BabyPanic(super::goals::Panic::new(1.25))); - g.add(2, MeleeAttack::new(1.0, true)); + // HoglinAi: MeleeAttack.create(40) for adults, 15 for babies. + g.add(2, MeleeAttack::new(1.0, true).intervals(40, 15)); g.add(3, super::goals::Breed::new(1.0)); g.add(3, HoglinAvoidRepellent); g.add(4, super::goals::FollowParent::new(1.1)); @@ -185,7 +186,8 @@ pub fn register_hoglin(m: &mut Mob) { pub fn register_zoglin(m: &mut Mob) { let g = &mut m.ai.goals; g.add(0, Float); - g.add(2, MeleeAttack::new(1.0, true)); + // Zoglin.initMemories: MeleeAttack.create(40) for adults, 15 for babies. + g.add(2, MeleeAttack::new(1.0, true).intervals(40, 15)); g.add(5, Stroll::avoiding_water(0.4)); g.add(6, LookAtPlayer::new(8.0)); m.ai.targets.add(1, HurtByTarget::new()); From 4156a6ac93363904dbabe175e4986be0ec32b80c Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:16:25 +0100 Subject: [PATCH 2/9] Aim a mob's crossbow by the world difficulty RangedAttackMob.rangedAttackUncertainty is 14 - 4 * difficulty; Horizon always used the Normal value 6. --- crates/horizon-client/src/mobs/illager.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/mobs/illager.rs b/crates/horizon-client/src/mobs/illager.rs index f4cb18af8..e99010cbc 100644 --- a/crates/horizon-client/src/mobs/illager.rs +++ b/crates/horizon-client/src/mobs/illager.rs @@ -542,12 +542,12 @@ fn shoot_crossbow(m: &mut Mob, who: Who, cx: &mut Cx) { Some(Who::Mob(m.id)), ); p.set_bonus(super::gear::arrow_bonus(m)); - // rangedAttackUncertainty at normal difficulty: 14 - 2 * 4. + // rangedAttackUncertainty: 14 - 4 * difficulty. p.shoot( &mut crate::projectiles::own_random(m), [dx, dy, dz], 1.6, - 6.0, + (14 - i32::from(cx.w.difficulty.id) * 4) as f32, ); cx.events.push(MobEvent::Projectile(p)); let pitch = 1.0 / (m.random.next_float() * 0.5 + 1.8) + 0.53; From f9fca5688d079b797eb77aca2a5bf5282d0e6f40 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:17:23 +0100 Subject: [PATCH 3/9] Give witches their resistance to magic Witch.getDamageAfterMagicAbsorb takes 85% off #witch_resistant_to (magic, indirect_magic, sonic_boom, thorns) and all of the witch's own damage; Horizon had no such rule. --- crates/horizon-client/src/game/potions.rs | 6 ++++-- crates/horizon-client/src/mobs.rs | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/game/potions.rs b/crates/horizon-client/src/game/potions.rs index affd68782..635277ff8 100644 --- a/crates/horizon-client/src/game/potions.rs +++ b/crates/horizon-client/src/game/potions.rs @@ -960,7 +960,8 @@ impl Game<'_> { let amount = |base: i32| (0.5 * f64::from(base << amp) + 0.5) as i32 as f32; if (*id == "instant_damage") != inverted { - m.hurt(amount(6), Some(at), &mut self.world.random); + let harm = m.potion_harm(amount(6)); + m.hurt(harm, Some(at), &mut self.world.random); } else { m.health = (m.health + amount(4)).min(m.kind.max_health); } @@ -1228,8 +1229,9 @@ impl Game<'_> { }; let m = &mut self.mobs[i]; if harm { + let harm = m.potion_harm((intensity * f64::from(6 << amp) + 0.5) as i32 as f32); m.hurt( - (intensity * f64::from(6 << amp) + 0.5) as i32 as f32, + harm, Some([at.x, at.y, at.z]), &mut self.world.random, ); diff --git a/crates/horizon-client/src/mobs.rs b/crates/horizon-client/src/mobs.rs index db617e7c9..f42f915ad 100644 --- a/crates/horizon-client/src/mobs.rs +++ b/crates/horizon-client/src/mobs.rs @@ -2085,6 +2085,18 @@ impl Mob { if epf > 0.0 { amount *= 1.0 - epf / 25.0; } + // Witch.getDamageAfterMagicAbsorb: none from its own doing, else + // 85% less from `#witch_resistant_to`. + if self.species() == Species::Witch { + if source.attacker == Some(Who::Mob(self.id)) { + amount = 0.0; + } else if matches!( + source.kind, + DamageKind::Magic | DamageKind::SonicBoom | DamageKind::Thorns + ) { + amount *= 0.15; + } + } // Wolf.actuallyHurt: wolf armor takes the damage instead of the wolf. let absorbed = self.wolf_armor_absorbs(&source); let mut knock = true; @@ -2167,6 +2179,15 @@ impl Mob { } true } + /// A splash or cloud's harming effect on this mob: the potion's + /// `indirect_magic` is in `#witch_resistant_to`, so a witch takes 15%. + pub fn potion_harm(&self, amount: f32) -> f32 { + if self.species() == Species::Witch { + amount * 0.15 + } else { + amount + } + } /// `Wolf.canArmorAbsorb`: it wears wolf armor and the damage type is not /// in `#bypasses_wolf_armor` (drowning, magic, thorns, in a wall, out of /// the world and the untyped kills). From ad8ef0b7e84fdd682c28036a79171dcf68f554cc Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:17:55 +0100 Subject: [PATCH 4/9] Wither a skull's target by difficulty, and only on a hit WitherSkull.onHitEntity adds Wither for 10 s on Normal, 40 s on Hard and nothing on Easy, only when the hit hurt; Horizon always gave 10 s. --- crates/horizon-client/src/game/wither.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/crates/horizon-client/src/game/wither.rs b/crates/horizon-client/src/game/wither.rs index aa56409b1..83772d5fa 100644 --- a/crates/horizon-client/src/game/wither.rs +++ b/crates/horizon-client/src/game/wither.rs @@ -120,7 +120,8 @@ impl Game<'_> { Ok(()) } /// `WitherSkull.onHitEntity` / `onHit`: 8 damage (healing the wither 5 - /// when it kills), withering for 10 seconds, then a power 1 blast. + /// when it kills), withering on a hit (10 seconds on Normal, 40 on Hard, +/// none on Easy), then a power 1 blast. pub(super) fn wither_skull_hit( &mut self, p: &Projectile, @@ -132,17 +133,24 @@ impl Game<'_> { _ => None, }; let amount = if owner.is_some() { 8.0 } else { 5.0 }; + let wither_ticks = match self.difficulty_id() { + 2 => 200, + 3 => 800, + _ => 0, + }; match who { Some(Who::Player) => { if !self.creative { // WitherSkull.onHitEntity's source: the wither launched it. self.combat.projectile_owner = owner; - self.mob_hits_player_kind( + let hit = self.mob_hits_player( amount, [p.previous.x, p.previous.y, p.previous.z], "minecraft:wither_skull", ); - self.give_player_effect("minecraft:wither", 200, 1); + if hit && wither_ticks > 0 { + self.give_player_effect("minecraft:wither", wither_ticks, 1); + } } } Some(Who::Mob(id)) => { @@ -154,8 +162,8 @@ impl Game<'_> { let killed = match self.mobs.iter_mut().find(|m| m.id == id) { Some(m) => { let hit = m.damage(amount, source); - if hit && m.alive() && m.species() != Species::Wither { - m.add_effect("minecraft:wither", 200, 1); + if hit && m.alive() && m.species() != Species::Wither && wither_ticks > 0 { + m.add_effect("minecraft:wither", wither_ticks, 1); } hit && !m.alive() } From 57494e6871fde1832e4b2845bca4b3dbafc8a5a9 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:18:26 +0100 Subject: [PATCH 5/9] Slow mobs in cobwebs again WebBlock.entityInside makes a mob stuck at 0.25/0.05/0.25 (0.5/0.25/0.5 with Weaving) and ends its fall; spiders and withers ignore it. The block-effects pass replaced the earlier cobweb code and dropped it. --- crates/horizon-client/src/mobs/ai.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/crates/horizon-client/src/mobs/ai.rs b/crates/horizon-client/src/mobs/ai.rs index eaadf14a4..ea9119fd4 100644 --- a/crates/horizon-client/src/mobs/ai.rs +++ b/crates/horizon-client/src/mobs/ai.rs @@ -533,9 +533,9 @@ pub fn tick( true } /// `LivingEntity.aiStep` -> `Entity.applyEffectsFromBlocks` for the blocks -/// that hurt or hold a mob: the cactus (`CactusBlock.entityInside`, 1) and the -/// sweet berry bush (`SweetBerryBushBlock.entityInside`: stuck at 0.8, 0.75, -/// 0.8, and a grown bush pricks for 1 when the mob moved at least 0.003 on X +/// that hurt or hold a mob: the cactus (`CactusBlock.entityInside`, 1), the +/// cobweb (stuck at 0.25, 0.05, 0.25) and the sweet berry bush +/// (`SweetBerryBushBlock.entityInside`: stuck at 0.8, 0.75, 0.8, and a grown bush pricks for 1 when the mob moved at least 0.003 on X /// or Z this tick). The blocks are those the mob's box touches anywhere along /// its move this tick, from where it started to where it ended. fn effects_from_blocks(m: &mut Mob, w: &MobWorld) { @@ -562,6 +562,21 @@ fn effects_from_blocks(m: &mut Mob, w: &MobWorld) { "minecraft:cactus" => { m.damage(1.0, Damage::of(DamageKind::Cactus)); } + // WebBlock.entityInside -> makeStuckInBlock, which a + // spider ignores for cobwebs and a wither always. + "minecraft:cobweb" + if !matches!( + m.species(), + Species::Spider | Species::CaveSpider | Species::Wither + ) => + { + m.fall_distance = 0.0; + m.stuck_multiplier = if m.has_effect("minecraft:weaving") { + Vec3::new(0.5, 0.25, 0.5) + } else { + Vec3::new(0.25, f64::from(0.05_f32), 0.25) + }; + } "minecraft:sweet_berry_bush" if !matches!(m.species(), Species::Fox | Species::Bee) => { From 5703fdfdc498bfc10ecf38db104814e0223ec327 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:19:13 +0100 Subject: [PATCH 6/9] Let slimes, ghasts and calm piglins not block a bed ServerPlayer.startSleepInBed looks for Monster entities that isPreventingPlayerRest; slimes, ghasts, phantoms and unangry zombified piglins are not. Horizon counted every hostile-category mob. --- crates/horizon-client/src/game.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 8e591cf3b..04a2d5e05 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -10898,7 +10898,11 @@ impl Game<'_> { // Creative players skip the monster check (`!this.isCreative()`). let monsters = !self.creative && self.mobs.iter().any(|m| { - m.hostile() + // `Monster.class` entities that `isPreventingPlayerRest`: a + // zombified piglin only while it is angry. + horizon_client::mobs::ai::is_monster(m.species()) + && (m.species() != horizon_client::mobs::Species::ZombifiedPiglin + || (m.extra.anger > 0 && m.ai.target.is_some())) && m.alive() && (m.position.x - position.x).abs() < 8.0 && (m.position.y - position.y).abs() < 5.0 From a1dfcbf2b39337b8e2bafee5322f9488fc5e3aae Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:19:36 +0100 Subject: [PATCH 7/9] Remove the dragon's flame cloud when it takes off DragonSittingFlamingPhase.end discards the cloud it made; Horizon left it to last its full 200 ticks after the phase ended. --- crates/horizon-client/src/game/dragon.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/horizon-client/src/game/dragon.rs b/crates/horizon-client/src/game/dragon.rs index aaf1dba39..c246e6010 100644 --- a/crates/horizon-client/src/game/dragon.rs +++ b/crates/horizon-client/src/game/dragon.rs @@ -2230,12 +2230,20 @@ impl Game<'_> { .filter(|p| p.alive && !p.creative && !p.spectator) .collect(); let mut harmed: Vec<(FightWho, f32)> = Vec::new(); + // DragonSittingFlamingPhase.end discards the flame cloud. + let flame_over = self + .dragon + .as_ref() + .is_some_and(|d| !matches!(d.phase, Phase::Flaming { .. })); let mut clouds = std::mem::take(&mut self.breath_clouds); clouds.retain_mut(|c| { // Lingering potions' clouds tick with the potions. if c.potion.is_some() { return true; } + if c.from_dragon && flame_over { + return false; + } c.age += 1; if c.age >= c.duration { return false; From 0d7f842b091c57b84a2adc2359faf09a78761af0 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:20:01 +0100 Subject: [PATCH 8/9] Hurt the dragon with a wind charge AbstractWindCharge.onHitEntity hurts whatever it hits for 1, the dragon's parts included (crystals are not hit); Horizon only looked at ordinary mobs. --- crates/horizon-client/src/game/wind.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/horizon-client/src/game/wind.rs b/crates/horizon-client/src/game/wind.rs index b00cea116..86b4de7bc 100644 --- a/crates/horizon-client/src/game/wind.rs +++ b/crates/horizon-client/src/game/wind.rs @@ -121,6 +121,13 @@ impl Game<'_> { ); } } + // An ender dragon part takes the point of damage too; a crystal is + // not hit (`AbstractWindCharge.canHitEntity`). + Who::Mob(id) if id >= super::dragon::SPECIAL => { + if id < super::dragon::SPECIAL + 8 { + self.hit_special(id, 1.0, p.owner == Some(Who::Player), false); + } + } Who::Mob(id) => { let source = Damage { kind: DamageKind::Thrown, From f69088012b8b780a7453d5cc90a2ea7674c8a482 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Tue, 27 Oct 2026 22:32:05 +0100 Subject: [PATCH 9/9] Format the hostile mob fixes --- crates/horizon-client/src/game/potions.rs | 6 +----- crates/horizon-client/src/game/wither.rs | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/horizon-client/src/game/potions.rs b/crates/horizon-client/src/game/potions.rs index 635277ff8..8bcbf0561 100644 --- a/crates/horizon-client/src/game/potions.rs +++ b/crates/horizon-client/src/game/potions.rs @@ -1230,11 +1230,7 @@ impl Game<'_> { let m = &mut self.mobs[i]; if harm { let harm = m.potion_harm((intensity * f64::from(6 << amp) + 0.5) as i32 as f32); - m.hurt( - harm, - Some([at.x, at.y, at.z]), - &mut self.world.random, - ); + m.hurt(harm, Some([at.x, at.y, at.z]), &mut self.world.random); } else { m.health = (m.health + (intensity * f64::from(4 << amp) + 0.5) as i32 as f32) .min(m.kind.max_health); diff --git a/crates/horizon-client/src/game/wither.rs b/crates/horizon-client/src/game/wither.rs index 83772d5fa..2f69ce7f1 100644 --- a/crates/horizon-client/src/game/wither.rs +++ b/crates/horizon-client/src/game/wither.rs @@ -121,7 +121,7 @@ impl Game<'_> { } /// `WitherSkull.onHitEntity` / `onHit`: 8 damage (healing the wither 5 /// when it kills), withering on a hit (10 seconds on Normal, 40 on Hard, -/// none on Easy), then a power 1 blast. + /// none on Easy), then a power 1 blast. pub(super) fn wither_skull_hit( &mut self, p: &Projectile,