geforkt von Mirrors/Paper
1358d1e914
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 881e06e5 PR-725: Add Item Unlimited Lifetime APIs CraftBukkit Changes: 74c08312 SPIGOT-6962: Call EntityChangeBlockEvent when when FallingBlockEntity starts to fall 64db5126 SPIGOT-6959: Make /loot command ignore empty items for spawn 2d760831 Increase outdated build delay 9ed7e4fb SPIGOT-6138, SPIGOT-6415: Don't call CreatureSpawnEvent after cross-dimensional travel fc4ad813 SPIGOT-6895: Trees grown with applyBoneMeal() don't fire the StructureGrowthEvent 59733a2e SPIGOT-6961: Actually return a copy of the ItemMeta Spigot Changes: ffceeae3 SPIGOT-6956: Drop unload queue patch as attempt at fixing stop issue e19ddabd PR-1011: Add Item Unlimited Lifetime APIs 34d40b0e SPIGOT-2942: give command fires PlayerDropItemEvent, cancelling it causes Item Duplication
64 Zeilen
3.2 KiB
Diff
64 Zeilen
3.2 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 db4aed53ce28393ac34c06753647cbe1322e89c6..54a2f43e568b0104571abcb5d84aac35ddde3cd7 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -53,6 +53,11 @@ public class PaperWorldConfig {
|
|
|
|
set("despawn-ranges.soft", null);
|
|
set("despawn-ranges.hard", null);
|
|
+
|
|
+ set("spawn-limits.monsters", null);
|
|
+ set("spawn-limits.animals", null);
|
|
+ set("spawn-limits.water-animals", null);
|
|
+ set("spawn-limits.water-ambient", null);
|
|
}
|
|
|
|
if (needsSave) {
|
|
@@ -683,6 +688,21 @@ public class PaperWorldConfig {
|
|
zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance);
|
|
}
|
|
|
|
+ public Reference2IntMap<MobCategory> perWorldSpawnLimits = new Reference2IntOpenHashMap<>(net.minecraft.world.level.NaturalSpawner.SPAWNING_CATEGORIES.length);
|
|
+ private void perWorldSpawnLimits() {
|
|
+ perWorldSpawnLimits.defaultReturnValue(-1);
|
|
+ if (PaperConfig.version < 24) {
|
|
+ // ambient category already had correct name
|
|
+ perWorldSpawnLimits.put(MobCategory.MONSTER, getInt("spawn-limits.monsters", -1, false));
|
|
+ perWorldSpawnLimits.put(MobCategory.CREATURE, getInt("spawn-limits.animals", -1, false));
|
|
+ perWorldSpawnLimits.put(MobCategory.WATER_CREATURE, getInt("spawn-limits.water-animals", -1, false));
|
|
+ perWorldSpawnLimits.put(MobCategory.WATER_AMBIENT, getInt("spawn-limits.water-ambient", -1, false));
|
|
+ }
|
|
+ for (MobCategory value : net.minecraft.world.level.NaturalSpawner.SPAWNING_CATEGORIES) {
|
|
+ perWorldSpawnLimits.put(value, getInt("spawn-limits." + value.getName(), perWorldSpawnLimits.getInt(value)));
|
|
+ }
|
|
+ }
|
|
+
|
|
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 e2f88425ea748384af18b126c6478a58a3eba176..1d0eb961e3abc980845ff3ecc8a790a98c55e49c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -221,6 +221,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
this.biomeProvider = biomeProvider;
|
|
|
|
this.environment = env;
|
|
+ // Paper start - per world spawn limits
|
|
+ for (SpawnCategory spawnCategory : SpawnCategory.values()) {
|
|
+ if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
|
|
+ setSpawnLimit(spawnCategory, this.world.paperConfig.perWorldSpawnLimits.getInt(CraftSpawnCategory.toNMS(spawnCategory)));
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
@Override
|