Config to ignore nearby mobs when sleeping

This commit is contained in:
Encode42
2025-01-10 15:02:25 -08:00
committed by granny
parent dca11d5762
commit db15441456
3 changed files with 11 additions and 39 deletions

View File

@@ -48,6 +48,15 @@
this.setServerLevel(level);
this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
@@ -1564,7 +_,7 @@
new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0),
monster -> monster.isPreventingPlayerRest(this.serverLevel(), this)
);
- if (!entitiesOfClass.isEmpty()) {
+ if (!this.level().purpurConfig.playerSleepNearMonsters && !entitiesOfClass.isEmpty()) { // Purpur - Config to ignore nearby mobs when sleeping
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
}
}
@@ -2014,6 +_,26 @@
this.lastSentExp = -1; // CraftBukkit - Added to reset
}