Use the mob's own chunk for its local difficulty

This commit is contained in:
Kacpherek
2026-10-26 19:06:59 +01:00
parent fe8565b874
commit e98d939919
2 changed files with 5 additions and 1 deletions
@@ -549,6 +549,9 @@ impl Game<'_> {
..base.clone()
};
let m = &mut mobs[i];
// getCurrentDifficultyAt(blockPosition()): the mob's own chunk,
// not the local player's (a server thread has no player).
w.difficulty = self.local_difficulty([m.position.x, m.position.y, m.position.z]);
w.nearest_player = super::natural_spawning::nearest_player(
&players,
m.position.x,
+2 -1
View File
@@ -1503,7 +1503,8 @@ pub struct MobWorld<'a> {
pub biomes: &'a crate::biome::Biomes,
/// The `mob_griefing` game rule.
pub mob_griefing: bool,
/// `getCurrentDifficultyAt` near the player.
/// `getCurrentDifficultyAt` at the mob being ticked (near the player
/// outside the mob tick).
pub difficulty: spawning::LocalDifficulty,
/// The End (its dimension type's monster spawn light rules).
pub end: bool,