2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: chase <chasewhip20@gmail.com>
|
|
|
|
Date: Wed, 2 Dec 2020 22:43:39 -0800
|
|
|
|
Subject: [PATCH] add per world spawn limits
|
|
|
|
|
|
|
|
Taken from #2982. Credit to Chasewhip8
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2021-06-17 06:00:32 +02:00
|
|
|
index 37d438d131bd66c46a650a48c70af1fde5665fc7..b252fc8b88d380feede31f7bc3cca24b4452478b 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2021-06-17 06:00:32 +02:00
|
|
|
@@ -643,6 +643,19 @@ public class PaperWorldConfig {
|
2021-06-11 14:02:28 +02:00
|
|
|
zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public int spawnLimitMonsters = -1;
|
|
|
|
+ public int spawnLimitAnimals = -1;
|
|
|
|
+ public int spawnLimitWaterAnimals = -1;
|
|
|
|
+ public int spawnLimitWaterAmbient = -1;
|
|
|
|
+ public int spawnLimitAmbient = -1;
|
|
|
|
+ private void perWorldSpawnLimits() {
|
|
|
|
+ spawnLimitMonsters = getInt("spawn-limits.monsters", spawnLimitMonsters);
|
|
|
|
+ spawnLimitAnimals = getInt("spawn-limits.animals", spawnLimitAnimals);
|
|
|
|
+ spawnLimitWaterAnimals = getInt("spawn-limits.water-animals", spawnLimitWaterAnimals);
|
|
|
|
+ spawnLimitWaterAmbient = getInt("spawn-limits.water-ambient", spawnLimitWaterAmbient);
|
|
|
|
+ spawnLimitAmbient = getInt("spawn-limits.ambient", spawnLimitAmbient);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
public int lightQueueSize = 20;
|
|
|
|
private void lightQueueSize() {
|
|
|
|
lightQueueSize = getInt("light-queue-size", lightQueueSize);
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2021-06-16 12:14:53 +02:00
|
|
|
index 9031f4423bb59b8f41968a58924d967a915d2446..6a425d8d082b34475c90703f854a7ca49dda367c 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2021-06-15 06:55:46 +02:00
|
|
|
@@ -351,6 +351,13 @@ public class CraftWorld implements World {
|
2021-06-11 14:02:28 +02:00
|
|
|
this.generator = gen;
|
|
|
|
|
2021-06-15 06:55:46 +02:00
|
|
|
this.environment = env;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper start - per world spawn limits
|
|
|
|
+ this.monsterSpawn = this.world.paperConfig.spawnLimitMonsters;
|
|
|
|
+ this.animalSpawn = this.world.paperConfig.spawnLimitAnimals;
|
|
|
|
+ this.waterAnimalSpawn = this.world.paperConfig.spawnLimitWaterAnimals;
|
|
|
|
+ this.waterAmbientSpawn = this.world.paperConfig.spawnLimitWaterAmbient;
|
|
|
|
+ this.ambientSpawn = this.world.paperConfig.spawnLimitAmbient;
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|