Merge pull request #2085 from kacpherek/fix/2084-enderman-teleport

🤖 Agent: contrib-gate-17 verified this head (26.3 sources, integration tree build, clippy, tests, parity; details in the PR comment). Thanks @kacpherek!
This commit is contained in:
Ludovic Marie
2026-10-26 13:44:44 +01:00
committed by GitHub
2 changed files with 8 additions and 4 deletions
+5 -2
View File
@@ -391,6 +391,9 @@ impl Game<'_> {
}
pub(super) fn mob_world_base<'s>(&'s self, others: &'s [Seen]) -> MobWorld<'s> {
let (rain, thunder) = self.world.weather.levels(1.0);
// Level.canHaveWeather: only the overworld's rain and thunder levels
// ever rise, so nothing rains or thunders in the Nether or the End.
let weather = self.dim == Dim::Overworld;
let player = self.player_view();
MobWorld {
world: &self.world,
@@ -407,8 +410,8 @@ impl Game<'_> {
daylight: self.dim != Dim::Nether && self.sky_darken() < 4,
game_time: self.world.game_time,
day_time: self.world.day_time,
raining: rain > 0.2,
thundering: thunder > 0.9,
raining: weather && rain > 0.2,
thundering: weather && thunder > 0.9,
nether: self.dim == Dim::Nether,
block_tags: &self.res.items().block_tags,
biomes: self.res.biomes(),
+3 -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,