Fix merging spawning values

This commit is contained in:
Mariell Hoversholm 2020-12-05 14:59:05 +01:00 committed by MiniDigger
parent a932e8ad75
commit b5e23c7a62

View file

@ -656,7 +656,7 @@ index e7d9674e25c06090d57bba6c8229bc3b75cb67e6..70a291090f022ff7d79a75b94ac54b94
private static double a(ChunkCoordIntPair chunkcoordintpair, Entity entity) {
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 979988c3c39afd80ce0b99a65dff5618a69ab600..6c15409982fd8005fede7c56c1ca74db5993d548 100644
index 979988c3c39afd80ce0b99a65dff5618a69ab600..661ad8f8e67046211e001ea40d97660d7c88f8e5 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -29,6 +29,11 @@ public final class SpawnerCreature {
@ -683,7 +683,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..6c15409982fd8005fede7c56c1ca74db
});
}
}
@@ -124,13 +134,33 @@ public final class SpawnerCreature {
@@ -124,13 +134,31 @@ public final class SpawnerCreature {
continue;
}
@ -710,16 +710,15 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..6c15409982fd8005fede7c56c1ca74db
return spawnercreature_d.a(entitytypes, blockposition, ichunkaccess);
}, (entityinsentient, ichunkaccess) -> {
spawnercreature_d.a(entityinsentient, ichunkaccess);
- });
+ },
+ difference, worldserver.paperConfig.perPlayerMobSpawns ? worldserver.getChunkProvider().playerChunkMap::updatePlayerMobTypeMap : null);
+ spawnercreature_d.getEntityCountsByType().mergeInt(enumcreaturetype, spawnCount, (keyInMap, valueInMap) -> {
+ return Integer.valueOf(spawnCount + valueInMap.intValue());
});
+ spawnercreature_d.getEntityCountsByType().mergeInt(enumcreaturetype, spawnCount, Integer::sum);
+ // Paper end - per player mob spawning
}
}
@@ -139,22 +169,34 @@ public final class SpawnerCreature {
@@ -139,22 +167,34 @@ public final class SpawnerCreature {
}
public static void a(EnumCreatureType enumcreaturetype, WorldServer worldserver, Chunk chunk, SpawnerCreature.c spawnercreature_c, SpawnerCreature.a spawnercreature_a) {
@ -756,7 +755,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..6c15409982fd8005fede7c56c1ca74db
int k = 0;
while (k < 3) {
@@ -194,7 +236,7 @@ public final class SpawnerCreature {
@@ -194,7 +234,7 @@ public final class SpawnerCreature {
// Paper start
Boolean doSpawning = a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2);
if (doSpawning == null) {
@ -765,7 +764,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..6c15409982fd8005fede7c56c1ca74db
}
if (doSpawning && spawnercreature_c.test(biomesettingsmobs_c.c, blockposition_mutableblockposition, ichunkaccess)) {
// Paper end
@@ -202,7 +244,7 @@ public final class SpawnerCreature {
@@ -202,7 +242,7 @@ public final class SpawnerCreature {
if (entityinsentient == null) {
@ -774,7 +773,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..6c15409982fd8005fede7c56c1ca74db
}
entityinsentient.setPositionRotation(d0, (double) i, d1, worldserver.random.nextFloat() * 360.0F, 0.0F);
@@ -211,13 +253,18 @@ public final class SpawnerCreature {
@@ -211,13 +251,18 @@ public final class SpawnerCreature {
// CraftBukkit start
worldserver.addAllEntities(entityinsentient, SpawnReason.NATURAL);
if (!entityinsentient.dead) {
@ -796,7 +795,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..6c15409982fd8005fede7c56c1ca74db
}
if (entityinsentient.c(k1)) {
@@ -239,6 +286,7 @@ public final class SpawnerCreature {
@@ -239,6 +284,7 @@ public final class SpawnerCreature {
}
}
@ -804,7 +803,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..6c15409982fd8005fede7c56c1ca74db
}
private static boolean a(WorldServer worldserver, IChunkAccess ichunkaccess, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) {
@@ -479,8 +527,8 @@ public final class SpawnerCreature {
@@ -479,8 +525,8 @@ public final class SpawnerCreature {
public static class d {
@ -815,7 +814,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..6c15409982fd8005fede7c56c1ca74db
private final SpawnerCreatureProbabilities c;
private final Object2IntMap<EnumCreatureType> d;
@Nullable
@@ -541,7 +589,7 @@ public final class SpawnerCreature {
@@ -541,7 +587,7 @@ public final class SpawnerCreature {
// CraftBukkit start
private boolean a(EnumCreatureType enumcreaturetype, int limit) {