Stop endermen teleporting nonstop in the End
The End has a fixed time and no precipitation, so endermen there must not flee daylight or take rain damage.
This commit is contained in:
@@ -521,7 +521,7 @@ fn base_tick(m: &mut Mob, w: &MobWorld, events: &mut Vec<MobEvent>) {
|
||||
}
|
||||
|
||||
if m.kind.flags.water_sensitive
|
||||
&& (m.fluids.in_water || w.raining && w.can_see_sky(ex, ey, ez))
|
||||
&& (m.fluids.in_water || w.raining && !w.end && w.can_see_sky(ex, ey, ez))
|
||||
{
|
||||
m.damage(1.0, Damage::of(DamageKind::Drown));
|
||||
}
|
||||
|
||||
@@ -138,9 +138,10 @@ fn teleport_towards(
|
||||
let z = m.position.z + (m.random.next_double() - 0.5) * 8.0 - d[2] * 16.0;
|
||||
teleport_to(m, w, x, y, z, events)
|
||||
}
|
||||
/// Enderman.customServerAiStep: in daylight, flee by teleporting.
|
||||
/// Enderman.customServerAiStep: in daylight, flee by teleporting. The End has a
|
||||
/// fixed time, so `Level.isBrightOutside` is never true there.
|
||||
pub fn custom_server_ai_step(m: &mut Mob, cx: &mut Cx) {
|
||||
if cx.w.daylight && m.age as i32 >= m.extra.counter + 600 {
|
||||
if cx.w.daylight && !cx.w.end && m.age as i32 >= m.extra.counter + 600 {
|
||||
let br = super::hostile::mob_brightness(m, cx.w);
|
||||
let (x, y, z) = (
|
||||
m.position.x.floor() as i32,
|
||||
@@ -185,6 +186,7 @@ pub fn ai_step(m: &mut Mob, w: &MobWorld, events: &mut Vec<MobEvent>) {
|
||||
}
|
||||
if (m.fluids.in_water
|
||||
|| w.raining
|
||||
&& !w.end
|
||||
&& w.can_see_sky(
|
||||
m.position.x.floor() as i32,
|
||||
m.eye_y().floor() as i32,
|
||||
|
||||
Reference in New Issue
Block a user