Let slimes, ghasts and calm piglins not block a bed

ServerPlayer.startSleepInBed looks for Monster entities that isPreventingPlayerRest; slimes, ghasts, phantoms and unangry zombified piglins are not. Horizon counted every hostile-category mob.
This commit is contained in:
Kacpherek
2026-10-27 22:19:13 +01:00
parent 57494e6871
commit 5703fdfdc4
+5 -1
View File
@@ -10898,7 +10898,11 @@ impl Game<'_> {
// Creative players skip the monster check (`!this.isCreative()`).
let monsters = !self.creative
&& self.mobs.iter().any(|m| {
m.hostile()
// `Monster.class` entities that `isPreventingPlayerRest`: a
// zombified piglin only while it is angry.
horizon_client::mobs::ai::is_monster(m.species())
&& (m.species() != horizon_client::mobs::Species::ZombifiedPiglin
|| (m.extra.anger > 0 && m.ai.target.is_some()))
&& m.alive()
&& (m.position.x - position.x).abs() < 8.0
&& (m.position.y - position.y).abs() < 5.0