Use the real local difficulty for the phantom spawn check

The phantom spawn gate assumed a fixed effective difficulty of 2. Use the local difficulty at the player instead, so easy, hard, a long-played chunk and the moon phase change how often phantoms spawn.
This commit is contained in:
Kacpherek
2026-10-26 18:45:43 +01:00
parent 2ca383f36d
commit 6dcf4b3e8b
+3 -2
View File
@@ -366,9 +366,10 @@ impl Game<'_> {
if pos[1] < 63 || !self.can_see_sky(pos) {
return;
}
// DifficultyInstance.isHarderThan(random * 3) at normal difficulty.
// `getCurrentDifficultyAt(playerPos).isHarderThan(random * 3)`.
let difficulty = self.local_difficulty([position.x, position.y, position.z]);
let r = &mut self.world.random;
if r.next_float() * 3.0 >= 2.0 {
if difficulty.effective <= r.next_float() * 3.0 {
return;
}
if r.next_int_bound(since_rest.max(1)).unwrap_or(0) < 72000 {