Paper/patches/unapplied/server/0651-add-per-world-spawn-limits.patch

26 lines
1.1 KiB
Diff
Raw Normal View History

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/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
2022-11-10 01:05:46 +01:00
index b1382dab98963b362c49d2e8f1a97177eadeb22d..684e091e7eb68a3e9157e7b945248821553a03df 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -210,6 +210,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().entities.spawning.spawnLimits.getInt(CraftSpawnCategory.toNMS(spawnCategory)));
+ }
+ }
+ // Paper end
}
@Override