2021-06-11 12:02:28 +00: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-09-01 09:54:41 +00:00
|
|
|
index ba8ae4d1c86293ca5c95d830d145023b4fe21d71..fc9b69d87364b578327dffb657746c08ab505be3 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2021-09-01 09:54:41 +00:00
|
|
|
@@ -681,6 +681,19 @@ public class PaperWorldConfig {
|
2021-06-11 12:02:28 +00: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-09-23 21:07:44 +00:00
|
|
|
index a2a8080314966fe2e5d2692d6ee2f6ca65207161..00522af9b6c4938e9b0b169178243be53aab98d8 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2021-09-23 21:07:44 +00:00
|
|
|
@@ -209,6 +209,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
2021-08-25 07:59:26 +00:00
|
|
|
this.biomeProvider = biomeProvider;
|
2021-06-11 12:02:28 +00:00
|
|
|
|
2021-06-15 04:55:46 +00:00
|
|
|
this.environment = env;
|
2021-06-11 12:02:28 +00: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
|