Fix global limit display for MISC mob category (#6612)

This commit is contained in:
Jason 2021-09-16 16:40:11 -05:00 committed by GitHub
parent 3069eaee04
commit ce7516d853
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -270,7 +270,7 @@ index 2ef4b4c2ff81d0fa33d4630593266066d8e6a6f3..34bc24403a83ae578d2fc3956b488389
List<org.bukkit.World> worlds;
if (args.length < 2 || args[1].equals("*")) {
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 403f50ef908f65c62d4aaa7e5328faa0a7654480..b59f1554b4ad26d362c41c00b7a864a72efbd602 100644
index 403f50ef908f65c62d4aaa7e5328faa0a7654480..afb4e740fd11e0249e70e9aea7ae1e7bebca702f 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -144,28 +144,15 @@ public final class NaturalSpawner {
@ -310,7 +310,7 @@ index 403f50ef908f65c62d4aaa7e5328faa0a7654480..b59f1554b4ad26d362c41c00b7a864a7
}
if (!spawnThisTick || limit == 0) {
@@ -204,6 +191,23 @@ public final class NaturalSpawner {
@@ -204,6 +191,27 @@ public final class NaturalSpawner {
world.getProfiler().pop();
}
@ -327,7 +327,11 @@ index 403f50ef908f65c62d4aaa7e5328faa0a7654480..b59f1554b4ad26d362c41c00b7a864a7
+ }
+
+ public static int globalLimitForCategory(final ServerLevel level, final MobCategory category, final int spawnableChunkCount) {
+ return limitForCategory(level, category) * spawnableChunkCount / NaturalSpawner.MAGIC_NUMBER;
+ final int categoryLimit = limitForCategory(level, category);
+ if (categoryLimit < 1) {
+ return categoryLimit;
+ }
+ return categoryLimit * spawnableChunkCount / NaturalSpawner.MAGIC_NUMBER;
+ }
+ // Paper end
+