mob spawning option to ignore creative players

This commit is contained in:
granny
2025-01-12 16:11:49 -08:00
committed by granny
parent fec5e5f34f
commit fff1bdc2b8
3 changed files with 13 additions and 39 deletions

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/level/NaturalSpawner.java
+++ b/net/minecraft/world/level/NaturalSpawner.java
@@ -267,7 +_,7 @@
mutableBlockPos.set(x, y, z);
double d = x + 0.5;
double d1 = z + 0.5;
- Player nearestPlayer = level.getNearestPlayer(d, y, d1, -1.0, false);
+ Player nearestPlayer = level.getNearestPlayer(d, y, d1, -1.0, level.purpurConfig.mobSpawningIgnoreCreativePlayers); // Purpur - mob spawning option to ignore creative players
if (nearestPlayer != null) {
double d2 = nearestPlayer.distanceToSqr(d, y, d1);
if (level.isLoadedAndInBounds(mutableBlockPos) && isRightDistanceToPlayerAndSpawnPoint(level, chunk, mutableBlockPos, d2)) { // Paper - don't load chunks for mob spawn

View File

@@ -379,6 +379,7 @@ public class PurpurWorldConfig {
public boolean phantomSpawning;
public boolean villagerTraderSpawning;
public boolean villageSiegeSpawning;
public boolean mobSpawningIgnoreCreativePlayers = false;
private void mobSpawnerSettings() {
// values of "default" or null will default to true only if the world environment is normal (aka overworld)
Predicate<Boolean> predicate = (bool) -> (bool != null && bool) || (bool == null && environment == World.Environment.NORMAL);
@@ -387,6 +388,7 @@ public class PurpurWorldConfig {
phantomSpawning = getBoolean("gameplay-mechanics.mob-spawning.phantoms", predicate);
villagerTraderSpawning = getBoolean("gameplay-mechanics.mob-spawning.wandering-traders", predicate);
villageSiegeSpawning = getBoolean("gameplay-mechanics.mob-spawning.village-sieges", predicate);
mobSpawningIgnoreCreativePlayers = getBoolean("gameplay-mechanics.mob-spawning.ignore-creative-players", mobSpawningIgnoreCreativePlayers);
}
public boolean disableObserverClocks = false;