From 5b0b2630b1392d13ef18a12b8a0489eb5becc876 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 24 Mar 2019 12:46:52 -0400 Subject: [PATCH] Add a config for mob spawn change, really shouldn't use it turning this to true allows 1 player to deny other players the ability to have mobs spawn. It really is a bad idea and reverts back to iffy mob spawn limits where mob farms in the world stops natural spawns from occuring. Really recommend resorting to different solutions than ever using this config. --- ...al-Spawned-mobs-towards-natural-spaw.patch | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch index e92f05361..9120de7f7 100644 --- a/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch +++ b/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch @@ -16,8 +16,27 @@ 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 +index f259c4e514..fa1d88aa84 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + log("Using vanilla redstone algorithm."); + } + } ++ ++ 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)"); ++ } ++ } + } diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldEntityList.java b/src/main/java/com/destroystokyo/paper/PaperWorldEntityList.java -index a10a5bc138..8ad00c7d11 100644 +index a10a5bc138..346176cf98 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldEntityList.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldEntityList.java @@ -0,0 +0,0 @@ import net.minecraft.server.IAnimal; @@ -34,7 +53,7 @@ index a10a5bc138..8ad00c7d11 100644 public void updateEntityCount(Entity entity, int amt) { - if (!(entity instanceof IAnimal)) return; + // Only count natural spawns so that mob -+ if (!(entity instanceof IAnimal) || entity.spawnReason != SpawnReason.NATURAL) return; ++ if (!(entity instanceof IAnimal) || (entity.spawnReason != SpawnReason.NATURAL && !world.paperConfig.countAllMobsForSpawning)) return; if (entity instanceof EntityInsentient) { EntityInsentient entityinsentient = (EntityInsentient) entity;