2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
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
|
2023-09-10 04:28:03 +02:00
|
|
|
index 2503d4691e47083a9d99a38c4ed3f50a2374821a..23d53f3fd524cc4d827dc95ab95367702a110a05 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
2022-12-07 20:22:28 +01:00
|
|
|
@@ -88,6 +88,13 @@ public final class NaturalSpawner {
|
2021-06-11 14:02:28 +02:00
|
|
|
MobCategory enumcreaturetype = entity.getType().getCategory();
|
|
|
|
|
|
|
|
if (enumcreaturetype != MobCategory.MISC) {
|
|
|
|
+ // Paper start - Only count natural spawns
|
2023-06-07 23:35:19 +02:00
|
|
|
+ if (!entity.level().paperConfig().entities.spawning.countAllMobsForSpawning &&
|
2021-06-11 14:02:28 +02:00
|
|
|
+ !(entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL ||
|
|
|
|
+ entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
BlockPos blockposition = entity.blockPosition();
|
|
|
|
|
2021-11-24 06:44:21 +01:00
|
|
|
chunkSource.query(ChunkPos.asLong(blockposition), (chunk) -> {
|