2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2019-06-13 03:54:16 +02: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-06-09 10:12:20 +02:00
|
|
|
index f7c7c2871726e3a1673a693b9bd93910a28189b2..e8e61ce505cafccb3c8338bc5bbdf941f903bb27 100644
|
2019-06-13 03:54:16 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2020-05-06 10:35:20 +02:00
|
|
|
@@ -505,6 +505,16 @@ public class PaperWorldConfig {
|
2019-06-13 03:54:16 +02: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 10:12:20 +02:00
|
|
|
public int maxChunkSectionIndex;
|
2019-06-13 03:54:16 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
2020-06-09 10:12:20 +02:00
|
|
|
index c019f0287711f8301b47a3c8f3740ff2aecb998b..702dcc0387f85ebae8f1cfe9a8e79affef24281b 100644
|
2019-06-13 03:54:16 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
2020-05-10 11:52:31 +02:00
|
|
|
@@ -960,6 +960,13 @@ public class WorldServer extends World {
|
2019-07-20 06:01:24 +02:00
|
|
|
EnumCreatureType enumcreaturetype = entity.getEntityType().e();
|
2019-06-13 03:54:16 +02:00
|
|
|
|
2019-07-20 06:01:24 +02:00
|
|
|
if (enumcreaturetype != EnumCreatureType.MISC && this.getChunkProvider().b(entity)) {
|
|
|
|
+ // Paper start - Only count natural spawns
|
|
|
|
+ if (!this.paperConfig.countAllMobsForSpawning &&
|
|
|
|
+ !(entity.spawnReason == CreatureSpawnEvent.SpawnReason.NATURAL ||
|
2019-06-13 03:54:16 +02:00
|
|
|
+ entity.spawnReason == CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
|
2019-07-20 06:01:24 +02:00
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
object2intmap.mergeInt(enumcreaturetype, 1, Integer::sum);
|
2019-06-13 03:54:16 +02:00
|
|
|
}
|
2019-07-20 06:01:24 +02:00
|
|
|
}
|