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.
This commit is contained in:
Aikar 2019-03-24 12:46:52 -04:00
parent 458aa79f63
commit 76d2a4cb8f
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE

View File

@ -1,4 +1,4 @@
From c793973ddc0690b434945f844250b8e79d3bf60d Mon Sep 17 00:00:00 2001
From c00cbd11cd310d1b03883c60261ced22e8ae6cae 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
@ -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
@@ -594,4 +594,14 @@ 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
@@ -7,6 +7,7 @@ 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;