diff --git a/crates/horizon-client/src/mobs/ai.rs b/crates/horizon-client/src/mobs/ai.rs index 560afe08c..d61f2caa0 100644 --- a/crates/horizon-client/src/mobs/ai.rs +++ b/crates/horizon-client/src/mobs/ai.rs @@ -397,7 +397,13 @@ pub fn tick( } return false; } - if !m.no_ai { + if m.no_ai { + // Mob.aiStep still runs without AI (only serverAiStep is skipped), + // so the endermite's life keeps counting. + if m.species() == Species::Endermite { + endermite_lifetime(m); + } + } else { ai_step(m, w, level_random, events); } if m.species() == Species::Rabbit { @@ -955,6 +961,16 @@ fn custom_server_ai_step(m: &mut Mob, cx: &mut Cx) { _ => {} } } +/// Endermite.aiStep: `counter` is the life; an endermite not required to +/// persist is discarded at 2400. +fn endermite_lifetime(m: &mut Mob) { + if !m.persistent { + m.extra.counter += 1; + } + if m.extra.counter >= 2400 { + m.removed = true; + } +} fn species_ai_step(m: &mut Mob, w: &MobWorld, events: &mut Vec) { if family(m.species()) == Family::Aquatic { aquatic::ai_step(m, w, events); @@ -963,14 +979,7 @@ fn species_ai_step(m: &mut Mob, w: &MobWorld, events: &mut Vec) { Species::Enderman => super::enderman::ai_step(m, w, events), // Endermite.aiStep: `counter` is the life; an endermite not required // to persist is discarded at 2400. - Species::Endermite => { - if !m.persistent { - m.extra.counter += 1; - } - if m.extra.counter >= 2400 { - m.removed = true; - } - } + Species::Endermite => endermite_lifetime(m), Species::Wolf => super::tame::ai_step(m, w, events), Species::Cat => super::tame::cat_ai_step(m, events), Species::Blaze => super::nether::blaze_ai_step(m, events),