From e6898ff61ec8c9e157ebc8d70f3e6d4e27c275b5 Mon Sep 17 00:00:00 2001 From: Noah van der Aa Date: Sat, 12 Feb 2022 20:02:14 +0100 Subject: [PATCH] Fix IllegalArgumentException for /paper mobcaps command (#7472) --- .../0741-Add-paper-mobcaps-and-paper-playermobcaps.patch | 7 +++++-- patches/server/0772-Optimise-nearby-player-lookups.patch | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/patches/server/0741-Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/0741-Add-paper-mobcaps-and-paper-playermobcaps.patch index fc25fd94fc..ef154fc605 100644 --- a/patches/server/0741-Add-paper-mobcaps-and-paper-playermobcaps.patch +++ b/patches/server/0741-Add-paper-mobcaps-and-paper-playermobcaps.patch @@ -272,15 +272,18 @@ index f436ab35798c9b6e6cb2eb60d2c02cbf9b742e69..8934c9f2d578932aae43ea3da7894f2f List 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 8e63d93a574f2c37094770099ea8e1f45cde3db5..6a62214b2763538e20fd218c445990d7f2cbc737 100644 +index 8e63d93a574f2c37094770099ea8e1f45cde3db5..ded0c79bcf1f78c6858270c6787aa5baced856b6 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -191,6 +191,16 @@ public final class NaturalSpawner { +@@ -191,6 +191,19 @@ public final class NaturalSpawner { world.getProfiler().pop(); } + // Paper start + public static int globalLimitForCategory(final ServerLevel level, final MobCategory category, final int spawnableChunkCount) { ++ if (category == MobCategory.MISC) { ++ return -1; ++ } + final int categoryLimit = level.getWorld().getSpawnLimit(CraftSpawnCategory.toBukkit(category)); + if (categoryLimit < 1) { + return categoryLimit; diff --git a/patches/server/0772-Optimise-nearby-player-lookups.patch b/patches/server/0772-Optimise-nearby-player-lookups.patch index 94f902c8be..bf82f58283 100644 --- a/patches/server/0772-Optimise-nearby-player-lookups.patch +++ b/patches/server/0772-Optimise-nearby-player-lookups.patch @@ -287,10 +287,10 @@ index 742d4645a6d22d10bc2833e3b742a6bc653d473d..7dda99a5464816f1488fb110da587f12 protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, final DimensionType dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 6a62214b2763538e20fd218c445990d7f2cbc737..11524461954d7243da1058e7c9b7ce2ea455706d 100644 +index ded0c79bcf1f78c6858270c6787aa5baced856b6..96fe666d55ec98724ae67704026013ab1288fa99 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -259,7 +259,7 @@ public final class NaturalSpawner { +@@ -262,7 +262,7 @@ public final class NaturalSpawner { blockposition_mutableblockposition.set(l, i, i1); double d0 = (double) l + 0.5D; double d1 = (double) i1 + 0.5D; @@ -299,7 +299,7 @@ index 6a62214b2763538e20fd218c445990d7f2cbc737..11524461954d7243da1058e7c9b7ce2e if (entityhuman != null) { double d2 = entityhuman.distanceToSqr(d0, (double) i, d1); -@@ -332,7 +332,7 @@ public final class NaturalSpawner { +@@ -335,7 +335,7 @@ public final class NaturalSpawner { } private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) {