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:
@@ -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(),
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user