mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 20:16:19 +01:00
Don't make per-player scale mob counts with the spawn range
https://github.com/PaperMC/Paper/pull/3971#issuecomment-663316000
This commit is contained in:
parent
55e2de5c6e
commit
188df6501e
@ -656,7 +656,7 @@ index cacf60563826da0219754a67500fdc239b13f0cd..f06c41d06f853b625dbd46822126810d
|
||||
|
||||
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 8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc..b255ccb4501d85f1507b105d2793c7fb6a919f62 100644
|
||||
index 8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc..0a25523f3ca5df483b7916364fa9fb51a9d2b649 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 8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc..b255ccb4501d85f1507b105d2793c7fb
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -125,13 +135,36 @@ public final class SpawnerCreature {
|
||||
@@ -125,13 +135,33 @@ public final class SpawnerCreature {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -696,10 +696,7 @@ index 8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc..b255ccb4501d85f1507b105d2793c7fb
|
||||
+ if (worldserver.paperConfig.perPlayerMobSpawns) {
|
||||
+ int minDiff = Integer.MAX_VALUE;
|
||||
+ for (EntityPlayer entityplayer : worldserver.getChunkProvider().playerChunkMap.playerMobDistanceMap.getPlayersInRange(chunk.getPos())) {
|
||||
+ int chunkRange = entityplayer.playerNaturallySpawnedEvent.getSpawnRadius();
|
||||
+ double rangeScale = (double)((chunkRange * 2 + 1) * (chunkRange * 2 + 1)) / SpawnerCreature.b;
|
||||
+ int scaledLimit = (int)Math.round(rangeScale * limit);
|
||||
+ minDiff = Math.min(scaledLimit - worldserver.getChunkProvider().playerChunkMap.getMobCountNear(entityplayer, enumcreaturetype), minDiff);
|
||||
+ minDiff = Math.min(limit - worldserver.getChunkProvider().playerChunkMap.getMobCountNear(entityplayer, enumcreaturetype), minDiff);
|
||||
+ }
|
||||
+ difference = (minDiff == Integer.MAX_VALUE) ? 0 : minDiff;
|
||||
+ }
|
||||
@ -722,7 +719,7 @@ index 8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc..b255ccb4501d85f1507b105d2793c7fb
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,22 +173,34 @@ public final class SpawnerCreature {
|
||||
@@ -140,22 +170,34 @@ public final class SpawnerCreature {
|
||||
}
|
||||
|
||||
public static void a(EnumCreatureType enumcreaturetype, WorldServer worldserver, Chunk chunk, SpawnerCreature.c spawnercreature_c, SpawnerCreature.a spawnercreature_a) {
|
||||
@ -759,7 +756,7 @@ index 8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc..b255ccb4501d85f1507b105d2793c7fb
|
||||
int k = 0;
|
||||
|
||||
while (k < 3) {
|
||||
@@ -195,13 +240,13 @@ public final class SpawnerCreature {
|
||||
@@ -195,13 +237,13 @@ public final class SpawnerCreature {
|
||||
// Paper start
|
||||
Boolean doSpawning = a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomebase_biomemeta, blockposition_mutableblockposition, d2);
|
||||
if (doSpawning == null) {
|
||||
@ -775,7 +772,7 @@ index 8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc..b255ccb4501d85f1507b105d2793c7fb
|
||||
}
|
||||
|
||||
entityinsentient.setPositionRotation(d0, (double) i, d1, worldserver.random.nextFloat() * 360.0F, 0.0F);
|
||||
@@ -209,13 +254,18 @@ public final class SpawnerCreature {
|
||||
@@ -209,13 +251,18 @@ public final class SpawnerCreature {
|
||||
groupdataentity = entityinsentient.prepare(worldserver, worldserver.getDamageScaler(entityinsentient.getChunkCoordinates()), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
|
||||
// CraftBukkit start
|
||||
if (worldserver.addEntity(entityinsentient, SpawnReason.NATURAL)) {
|
||||
@ -797,7 +794,7 @@ index 8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc..b255ccb4501d85f1507b105d2793c7fb
|
||||
}
|
||||
|
||||
if (entityinsentient.c(k1)) {
|
||||
@@ -237,6 +287,7 @@ public final class SpawnerCreature {
|
||||
@@ -237,6 +284,7 @@ public final class SpawnerCreature {
|
||||
}
|
||||
|
||||
}
|
||||
@ -805,7 +802,7 @@ index 8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc..b255ccb4501d85f1507b105d2793c7fb
|
||||
}
|
||||
|
||||
private static boolean a(WorldServer worldserver, IChunkAccess ichunkaccess, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) {
|
||||
@@ -476,8 +527,8 @@ public final class SpawnerCreature {
|
||||
@@ -476,8 +524,8 @@ public final class SpawnerCreature {
|
||||
|
||||
public static class d {
|
||||
|
||||
@ -816,7 +813,7 @@ index 8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc..b255ccb4501d85f1507b105d2793c7fb
|
||||
private final SpawnerCreatureProbabilities c;
|
||||
private final Object2IntMap<EnumCreatureType> d;
|
||||
@Nullable
|
||||
@@ -540,7 +591,7 @@ public final class SpawnerCreature {
|
||||
@@ -540,7 +588,7 @@ public final class SpawnerCreature {
|
||||
|
||||
// CraftBukkit start
|
||||
private boolean a(EnumCreatureType enumcreaturetype, int limit) {
|
||||
|
Loading…
Reference in New Issue
Block a user