2019-04-05 04:52:02 +00:00
|
|
|
From 2c29c1376a6d21e9459fb15b2c99f6d34f0bb3ed Mon Sep 17 00:00:00 2001
|
2019-03-24 05:05:07 +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.
|
|
|
|
|
2019-03-24 16:46:52 +00:00
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2019-04-05 04:52:02 +00:00
|
|
|
index a5231169c..1d21277b7 100644
|
2019-03-24 16:46:52 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2019-04-05 04:52:02 +00:00
|
|
|
@@ -597,4 +597,14 @@ public class PaperWorldConfig {
|
2019-03-24 16:46:52 +00:00
|
|
|
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)");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
}
|
2019-03-24 05:05:07 +00:00
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldEntityList.java b/src/main/java/com/destroystokyo/paper/PaperWorldEntityList.java
|
2019-03-24 17:55:27 +00:00
|
|
|
index a10a5bc13..a5a63f800 100644
|
2019-03-24 05:05:07 +00:00
|
|
|
--- 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;
|
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
|
import net.minecraft.server.World;
|
|
|
|
import net.minecraft.server.WorldServer;
|
|
|
|
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Collection;
|
2019-03-24 17:55:27 +00:00
|
|
|
@@ -90,7 +91,12 @@ public class PaperWorldEntityList extends ArrayList<Entity> {
|
2019-03-24 05:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void updateEntityCount(Entity entity, int amt) {
|
|
|
|
- if (!(entity instanceof IAnimal)) return;
|
|
|
|
+ // Only count natural spawns so that mob
|
2019-03-24 17:55:27 +00:00
|
|
|
+ if (!(entity instanceof IAnimal) || (
|
|
|
|
+ !world.paperConfig.countAllMobsForSpawning &&
|
|
|
|
+ entity.spawnReason != SpawnReason.NATURAL &&
|
|
|
|
+ entity.spawnReason != SpawnReason.CHUNK_GEN
|
|
|
|
+ )) return;
|
2019-03-24 05:05:07 +00:00
|
|
|
|
|
|
|
if (entity instanceof EntityInsentient) {
|
|
|
|
EntityInsentient entityinsentient = (EntityInsentient) entity;
|
|
|
|
--
|
|
|
|
2.21.0
|
|
|
|
|