byte var8 = 8;
for (int var9 = -var8; var9 <= var8; ++var9) {
for (int var10 = -var8; var10 <= var8; ++var10) {
boolean var11 = var9 == -var8 || var9 == var8 || var10 == -var8 || var10 == var8;
ChunkCoordIntPair var12 = new ChunkCoordIntPair(var9 + var6, var10 + var7);
if (!var11) {
eligibleChunksForSpawning.put(var12, false);
} else if (!eligibleChunksForSpawning.containsKey(var12)) {
eligibleChunksForSpawning.put(var12, true);
}
}
}
}
var4 = 0;
ChunkCoordinates var32 = par0WorldServer.getSpawnPoint();
EnumCreatureType[] var33 = EnumCreatureType.values();
var7 = var33.length;
for (int var34 = 0; var34 < var7; ++var34) {
EnumCreatureType var35 = var33[var34];
if ((tpsFactor >= 1 || Math.random() < tpsFactor) && ((!var35.getPeacefulCreature() || par2) && (var35.getPeacefulCreature() || par1) && (!var35.getAnimal() || par3) && par0WorldServer.countEntities(var35.getCreatureClass()) <= var35.getMaxNumberOfCreature() * eligibleChunksForSpawning.size() / 256)) {
ArrayList<ChunkCoordIntPair> tmp = new ArrayList<ChunkCoordIntPair>(eligibleChunksForSpawning.keySet());
Collections.shuffle(tmp);
Iterator<ChunkCoordIntPair> var37 = tmp.iterator();
label110:
while (var37.hasNext()) {
ChunkCoordIntPair var36 = var37.next();
if (par0WorldServer.theChunkProviderServer.chunkExists(var36.chunkXPos, var36.chunkZPos) && !eligibleChunksForSpawning.get(var36)) {
ChunkPosition var38 = getRandomSpawningPointInChunk(par0WorldServer, var36.chunkXPos, var36.chunkZPos);
int var13 = var38.x;
int var14 = var38.y;