From 49a224df9fb0a3762643c942c5ac9c9a67737e0c Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 22 Oct 2026 03:15:11 +0200 Subject: [PATCH] Axolotl: free water paths, flat walk targets and the attack sound Three differences from vanilla's Axolotl kept the brain from matching: - The constructor's setPathfindingMalus(WATER, 0) was missing, so every swim target in water failed DefaultRandomPos's malus check and idle axolotls never picked a walk target. - Axolotl.getWalkTargetValue returns 0 everywhere; Horizon used Animal's light-based value, which picked the brightest candidate instead of the first. - Axolotl.playAttackSound (entity.axolotl.attack at pitch 1) never played. The mob AI harness gets #64's two scenarios, in a pool sunk into the ground so no water flows out of it: hunting a cod, and playing dead after repeated hits. Both now match vanilla on every tick (393/393 mob-ticks, was 26). Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/mobs/ai.rs | 10 ++++++++-- crates/horizon-client/src/mobs/aquatic.rs | 3 +++ tools/test_mob_ai_parity.py | 7 +++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/mobs/ai.rs b/crates/horizon-client/src/mobs/ai.rs index 34276ddda..ae4aa91a6 100644 --- a/crates/horizon-client/src/mobs/ai.rs +++ b/crates/horizon-client/src/mobs/ai.rs @@ -1240,10 +1240,10 @@ pub fn walk_target_value(m: &Mob, w: &MobWorld, p: [i32; 3]) -> f32 { 0.0 }; } - // AbstractNautilus and Creaking.getWalkTargetValue: everywhere alike. + // AbstractNautilus, Axolotl and Creaking.getWalkTargetValue: everywhere alike. if matches!( m.species(), - Species::Nautilus | Species::ZombieNautilus | Species::Creaking + Species::Nautilus | Species::ZombieNautilus | Species::Axolotl | Species::Creaking ) { return 0.0; } @@ -1406,6 +1406,12 @@ pub fn do_hurt_target(m: &mut Mob, who: Who, cx: &mut Cx) { if super::creaking::is_creaking(m) { m.voice("entity.creaking.attack", cx.events); } + // Axolotl.playAttackSound: playSound(AXOLOTL_ATTACK, 1.0, 1.0). + if m.species() == Species::Axolotl { + let at = [m.position.x, m.position.y, m.position.z]; + cx.events + .push(MobEvent::Sound("entity.axolotl.attack", at, 1.0, 1.0)); + } let _ = Fluid::None; } /// Mob.ate (sheep regrow wool, babies grow). diff --git a/crates/horizon-client/src/mobs/aquatic.rs b/crates/horizon-client/src/mobs/aquatic.rs index 702e3740d..6afacb53a 100644 --- a/crates/horizon-client/src/mobs/aquatic.rs +++ b/crates/horizon-client/src/mobs/aquatic.rs @@ -46,6 +46,9 @@ pub fn register(m: &mut Mob) { }; m.ai.look.kind = super::control::LookKind::SmoothSwimming(20.0); m.ai.nav.kind = NavKind::Amphibious; + // `Axolotl()`: water costs nothing, so swim targets in water pass + // DefaultRandomPos's malus check. + m.set_malus(super::path::PathType::Water, 0.0); super::animal_brain::init(m, i64::from(m.id)); } S::Tadpole => { diff --git a/tools/test_mob_ai_parity.py b/tools/test_mob_ai_parity.py index 6eda7583e..01ed4680f 100644 --- a/tools/test_mob_ai_parity.py +++ b/tools/test_mob_ai_parity.py @@ -268,6 +268,13 @@ def scenarios(): ('witch', 176), ('vindicator', 177), ('zombie', 178)]: add(f'{species}_deep_water', 160, ['fill -4 -64 -4 4 -61 4 minecraft:water', f'mob minecraft:{species} 0.5 -62 0.5 0 {seed} persistent']) + # Axolotls (#64): idle swimming, hunting a cod, and playing dead after hits, in a pool sunk into + # the ground so no water flows out of it (the probe doesn't tick fluids). + POOL = 'fill -5 -63 -5 5 -61 5 minecraft:water' + add('axolotl_hunting', 45, [POOL, 'player 12.5 -60 0.5', 'mob minecraft:axolotl 0.5 -62 0.5 0 12 persistent', + 'mob minecraft:cod 2.5 -62 0.5 0 13 persistent noai']) + add('axolotl_play_dead', 300, [POOL, 'player 12.5 -60 0.5', 'mob minecraft:axolotl 0.5 -62 0.5 0 28 persistent'] + + [f'hurt {t} 0' for t in range(4, 160, 12)]) return s