-
-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mob spawning option to ignore creative players
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
patches/server/0294-mob-spawning-option-to-ignore-creative-players.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: granny <granny@pl3x.net> | ||
Date: Fri, 26 Aug 2022 22:44:41 -0700 | ||
Subject: [PATCH] mob spawning option to ignore creative players | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java | ||
index 4a8998a98987985e259b0a2a29ee7c94c1f3a4b1..17a93a11a3b69128defc392816858d9528714c26 100644 | ||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java | ||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java | ||
@@ -259,7 +259,7 @@ public final class NaturalSpawner { | ||
blockposition_mutableblockposition.set(l, i, i1); | ||
double d0 = (double) l + 0.5D; | ||
double d1 = (double) i1 + 0.5D; | ||
- Player entityhuman = (chunk instanceof LevelChunk) ? ((LevelChunk)chunk).findNearestPlayer(d0, i, d1, 576.0D, net.minecraft.world.entity.EntitySelector.NO_SPECTATORS) : world.getNearestPlayer(d0, (double) i, d1, -1.0D, false); // Paper - use chunk's player cache to optimize search in range | ||
+ Player entityhuman = (chunk instanceof LevelChunk) ? ((LevelChunk)chunk).findNearestPlayer(d0, i, d1, 576.0D, world.purpurConfig.mobSpawningIgnoreCreativePlayers ? net.minecraft.world.entity.EntitySelector.NO_CREATIVE_OR_SPECTATOR : net.minecraft.world.entity.EntitySelector.NO_SPECTATORS) : world.getNearestPlayer(d0, (double) i, d1, -1.0D, world.purpurConfig.mobSpawningIgnoreCreativePlayers); // Paper - use chunk's player cache to optimize search in range // Purpur | ||
|
||
if (entityhuman != null) { | ||
double d2 = entityhuman.distanceToSqr(d0, (double) i, d1); | ||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java | ||
index 2a3ae8ba73a547d02e7a635321e4534de7daafdc..45eebbc1993b53b4d01317c6089b619f026d53ed 100644 | ||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java | ||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java | ||
@@ -375,6 +375,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); | ||
@@ -383,6 +384,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; |