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:
Kacpherek
2026-10-26 11:05:49 +01:00
parent 2a0f4e39a8
commit 311c0f7392
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -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));
}
+4 -2
View File
@@ -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,