Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 19:40:07 +01:00
4104545b11
"It was from a different time before books were as jank as they are now. As time has gone on they've only proven to be worse and worse."
50 Zeilen
2.5 KiB
Diff
50 Zeilen
2.5 KiB
Diff
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
|
|
index 4a24d7ae6b65fced643859a965ce1d4f6a3828fd..a1d02e22bd67f1f1258dfffcf435018a5952afb8 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -658,6 +658,19 @@ public class PaperWorldConfig {
|
|
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
|
|
index 1cc8a85ae69c98987ab516418808b688c266711c..3403b75c8311f1e52a0533363c5f0307442f8a15 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -351,6 +351,13 @@ public class CraftWorld implements World {
|
|
this.generator = gen;
|
|
|
|
this.environment = env;
|
|
+ // 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
|