return 0;
}
profiler.startSection("spawnableChunks");
int attemptedSpawnedMobs = 0;
LongSet closeChunks = new LongSet();
Collection<EntityPlayer> entityPlayers = worldServer.playerEntities;
LongList spawnableChunks = new LongList(entityPlayers.size() * maxChunksPerPlayer);
for (EntityPlayer entityPlayer : entityPlayers) {
int pX = entityPlayer.chunkCoordX;
int pZ = entityPlayer.chunkCoordZ;
int x = pX - closeRange;
int maxX = pX + closeRange;
int startZ = pZ - closeRange;
int maxZ = pZ + closeRange;
for (; x <= maxX; x++) {
for (int z = startZ; z <= maxZ; z++) {
closeChunks.add(hash(x, z));
}
}
}
for (EntityPlayer entityPlayer : entityPlayers) {
int pX = entityPlayer.chunkCoordX;
int pZ = entityPlayer.chunkCoordZ;
int x = pX - farRange;
int maxX = pX + farRange;
int startZ = pZ - farRange;
int maxZ = pZ + farRange;
for (; x <= maxX; x++) {
for (int z = startZ; z <= maxZ; z++) {
long hash = hash(x, z);
if (!closeChunks.contains(hash)) {
spawnableChunks.add(hash);
}
}
}
}