2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2019-06-13 01:54:16 +00:00
|
|
|
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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-11-03 02:22:15 +00:00
|
|
|
index 75c30889ec186dbae35159d9a4a38494fad0f6df..18874a9b57cafb5c5c4fbcf87a3ecfd9ebb96440 100644
|
2019-06-13 01:54:16 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-08-25 02:22:08 +00:00
|
|
|
@@ -457,6 +457,16 @@ public class PaperWorldConfig {
|
2019-06-13 01:54:16 +00:00
|
|
|
maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public boolean countAllMobsForSpawning = false;
|
|
|
|
+ private void countAllMobsForSpawning() {
|
|
|
|
+ countAllMobsForSpawning = getBoolean("count-all-mobs-for-spawning", false);
|
|
|
|
+ if (countAllMobsForSpawning) {
|
|
|
|
+ log("Counting all mobs for spawning. Mob farms may reduce natural spawns elsewhere in world.");
|
|
|
|
+ } else {
|
|
|
|
+ log("Using improved mob spawn limits (Only Natural Spawns impact spawn limits for more natural spawns)");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
public boolean antiXray;
|
|
|
|
public EngineMode engineMode;
|
2020-06-09 08:12:20 +00:00
|
|
|
public int maxChunkSectionIndex;
|
2020-06-25 23:38:24 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
2020-08-25 02:22:08 +00:00
|
|
|
index 2561ba9b9c02ccb59bd7284ddfe62889911d4220..99d4d6b4bdedcba7964ddc99467b8f8e5229b98a 100644
|
2020-06-25 23:38:24 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
|
|
@@ -48,6 +48,13 @@ public final class SpawnerCreature {
|
2019-07-20 04:01:24 +00:00
|
|
|
EnumCreatureType enumcreaturetype = entity.getEntityType().e();
|
2019-06-13 01:54:16 +00:00
|
|
|
|
2020-06-25 23:38:24 +00:00
|
|
|
if (enumcreaturetype != EnumCreatureType.MISC) {
|
2019-07-20 04:01:24 +00:00
|
|
|
+ // Paper start - Only count natural spawns
|
2020-06-25 23:38:24 +00:00
|
|
|
+ if (!entity.world.paperConfig.countAllMobsForSpawning &&
|
|
|
|
+ !(entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL ||
|
|
|
|
+ entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
|
2019-07-20 04:01:24 +00:00
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
2020-06-25 23:38:24 +00:00
|
|
|
BlockPosition blockposition = entity.getChunkCoordinates();
|
|
|
|
long j = ChunkCoordIntPair.pair(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
|
|
|
|