aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0302-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0302-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch')
-rw-r--r--patches/server/0302-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/patches/server/0302-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/patches/server/0302-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch
new file mode 100644
index 0000000000..a310ad9f1a
--- /dev/null
+++ b/patches/server/0302-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch
@@ -0,0 +1,36 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aikar <[email protected]>
+Date: Sun, 24 Mar 2019 01:01:32 -0400
+Subject: [PATCH] Only count Natural Spawned mobs towards natural spawn mob
+ limit
+
+This resolves the super common complaint about mobs not spawning.
+
+This was ultimately a flaw in the vanilla count algorithim that allows
+spawners and other misc mobs to count against the mob limit, which are
+not bounded, and can prevent the entire world from spawning new.
+
+I believe Bukkits changes around persistence may of actually made it
+worse than vanilla.
+
+This should fully solve all of the issues around it so that only natural
+influences natural spawns.
+
+diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+index d5ada3301429e7fec0d157d7a33d4937e0f82fbb..5247782edc426107fb4b3ade5d92f148c0b6e681 100644
+--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
++++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+@@ -88,6 +88,13 @@ public final class NaturalSpawner {
+ MobCategory enumcreaturetype = entity.getType().getCategory();
+
+ if (enumcreaturetype != MobCategory.MISC) {
++ // Paper start - Only count natural spawns
++ if (!entity.level().paperConfig().entities.spawning.countAllMobsForSpawning &&
++ !(entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL ||
++ entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
++ continue;
++ }
++ // Paper end - Only count natural spawns
+ BlockPos blockposition = entity.blockPosition();
+
+ chunkSource.query(ChunkPos.asLong(blockposition), (chunk) -> {