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-03-14 20:54:57 +01:00
|
|
|
index 029835914c3c88811684e90b29bfed83191b3b3f..05c014c5f0805d50cfd251b043c79ce3355eef16 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
|
2022-06-09 10:51:45 +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) -> {
|