Paper/patches/server/0321-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch

37 lines
1.8 KiB
Diff
Raw Normal View History

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
2022-12-07 20:22:28 +01:00
index c3d6b904f1310c93a3d5c1e5e3fab2f3476f5a48..29dac07176eb99517c9cddbe012636908c3603fe 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
+ 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) -> {