aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-10-31 18:12:36 +0100
committerNassim Jahnke <[email protected]>2024-10-31 18:12:36 +0100
commit84281ceeefb9d294758a9a292ba6c01da40e8409 (patch)
treec1af3d6c4a6194c055d1830047f35413c81a633f
parent4d2672e1ac157519f921fb0421100aa9ab4856de (diff)
downloadPaper-84281ceeefb9d294758a9a292ba6c01da40e8409.tar.gz
Paper-84281ceeefb9d294758a9a292ba6c01da40e8409.zip
Don't count mobs twice in per-player-mob-spawns
-rw-r--r--patches/server/0991-Optional-per-player-mob-spawns.patch21
-rw-r--r--patches/server/0995-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch4
2 files changed, 12 insertions, 13 deletions
diff --git a/patches/server/0991-Optional-per-player-mob-spawns.patch b/patches/server/0991-Optional-per-player-mob-spawns.patch
index fee5589666..2d0b4bd952 100644
--- a/patches/server/0991-Optional-per-player-mob-spawns.patch
+++ b/patches/server/0991-Optional-per-player-mob-spawns.patch
@@ -85,7 +85,7 @@ index 30f53916a9e49165bcfef2bea2c0b50a26f5a8a3..cb961d9051416626f499c1ca87107f11
// CraftBukkit start
public CraftPlayer.TransferCookieConnection transferCookieConnection;
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
-index ea6533c1ac218aa075da3401807a06fcb7892321..364510c0d0667e67aa3b25099a021f5f856fc113 100644
+index ea6533c1ac218aa075da3401807a06fcb7892321..558110e3d9d97b3eddd02e807039e6a31fcc3a63 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -67,6 +67,12 @@ public final class NaturalSpawner {
@@ -119,7 +119,7 @@ index ea6533c1ac218aa075da3401807a06fcb7892321..364510c0d0667e67aa3b25099a021f5f
});
}
}
-@@ -138,13 +149,35 @@ public final class NaturalSpawner {
+@@ -138,13 +149,34 @@ public final class NaturalSpawner {
continue;
}
@@ -150,14 +150,13 @@ index ea6533c1ac218aa075da3401807a06fcb7892321..364510c0d0667e67aa3b25099a021f5f
Objects.requireNonNull(info);
- NaturalSpawner.spawnCategoryForChunk(enumcreaturetype, world, chunk, spawnercreature_c, info::afterSpawn);
+ // Paper start - Optional per player mob spawns
-+ int spawnCount = NaturalSpawner.spawnCategoryForChunk(enumcreaturetype, world, chunk, spawnercreature_c, info::afterSpawn,
++ NaturalSpawner.spawnCategoryForChunk(enumcreaturetype, world, chunk, spawnercreature_c, info::afterSpawn,
+ difference, world.paperConfig().entities.spawning.perPlayerMobSpawns ? world.getChunkSource().chunkMap::updatePlayerMobTypeMap : null);
-+ info.mobCategoryCounts.mergeInt(enumcreaturetype, spawnCount, Integer::sum);
+ // Paper end - Optional per player mob spawns
}
}
-@@ -163,11 +196,17 @@ public final class NaturalSpawner {
+@@ -163,11 +195,17 @@ public final class NaturalSpawner {
// Paper end - Add mobcaps commands
public static void spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) {
@@ -176,7 +175,7 @@ index ea6533c1ac218aa075da3401807a06fcb7892321..364510c0d0667e67aa3b25099a021f5f
}
@VisibleForDebug
-@@ -178,15 +217,21 @@ public final class NaturalSpawner {
+@@ -178,15 +216,21 @@ public final class NaturalSpawner {
});
}
@@ -199,7 +198,7 @@ index ea6533c1ac218aa075da3401807a06fcb7892321..364510c0d0667e67aa3b25099a021f5f
int k = 0;
while (k < 3) {
-@@ -228,14 +273,14 @@ public final class NaturalSpawner {
+@@ -228,14 +272,14 @@ public final class NaturalSpawner {
// Paper start - PreCreatureSpawnEvent
PreSpawnStatus doSpawning = isValidSpawnPostitionForType(world, group, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2);
if (doSpawning == PreSpawnStatus.ABORT) {
@@ -216,7 +215,7 @@ index ea6533c1ac218aa075da3401807a06fcb7892321..364510c0d0667e67aa3b25099a021f5f
}
entityinsentient.moveTo(d0, (double) i, d1, world.random.nextFloat() * 360.0F, 0.0F);
-@@ -248,10 +293,15 @@ public final class NaturalSpawner {
+@@ -248,10 +292,15 @@ public final class NaturalSpawner {
++j;
++k1;
runner.run(entityinsentient, chunk);
@@ -234,7 +233,7 @@ index ea6533c1ac218aa075da3401807a06fcb7892321..364510c0d0667e67aa3b25099a021f5f
}
if (entityinsentient.isMaxGroupSizeReached(k1)) {
-@@ -273,6 +323,7 @@ public final class NaturalSpawner {
+@@ -273,6 +322,7 @@ public final class NaturalSpawner {
}
}
@@ -242,7 +241,7 @@ index ea6533c1ac218aa075da3401807a06fcb7892321..364510c0d0667e67aa3b25099a021f5f
}
private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) {
-@@ -523,7 +574,7 @@ public final class NaturalSpawner {
+@@ -523,7 +573,7 @@ public final class NaturalSpawner {
MobCategory enumcreaturetype = entitytypes.getCategory();
this.mobCategoryCounts.addTo(enumcreaturetype, 1);
@@ -251,7 +250,7 @@ index ea6533c1ac218aa075da3401807a06fcb7892321..364510c0d0667e67aa3b25099a021f5f
}
public int getSpawnableChunkCount() {
-@@ -539,6 +590,7 @@ public final class NaturalSpawner {
+@@ -539,6 +589,7 @@ public final class NaturalSpawner {
int i = limit * this.spawnableChunkCount / NaturalSpawner.MAGIC_NUMBER;
// CraftBukkit end
diff --git a/patches/server/0995-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch b/patches/server/0995-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch
index 29e8f09721..e41fe85d1a 100644
--- a/patches/server/0995-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch
+++ b/patches/server/0995-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch
@@ -72,10 +72,10 @@ index cb961d9051416626f499c1ca87107f1114433c94..8dc3ba983fd4c61e463867be8d224aa9
// CraftBukkit start
public CraftPlayer.TransferCookieConnection transferCookieConnection;
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
-index 364510c0d0667e67aa3b25099a021f5f856fc113..e524b27d185da3e88668f8ef107517272860bd66 100644
+index 558110e3d9d97b3eddd02e807039e6a31fcc3a63..743a33ae2814c513b84b1a60e50a3c24527568f8 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
-@@ -272,6 +272,11 @@ public final class NaturalSpawner {
+@@ -271,6 +271,11 @@ public final class NaturalSpawner {
// Paper start - PreCreatureSpawnEvent
PreSpawnStatus doSpawning = isValidSpawnPostitionForType(world, group, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2);