Count the endermite lifetime with NoAI set
This commit is contained in:
@@ -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<MobEvent>) {
|
||||
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<MobEvent>) {
|
||||
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),
|
||||
|
||||
Reference in New Issue
Block a user