private ChunkCoordinates findNearestBiome(EntityPlayer player, ArrayList<Integer> biomesToSearch) {
int loadChunkDistance = 25;
ChunkCoordinates coordinates = null;
Vect pos = new Vect((int) player.posX, (int) player.posY, (int) player.posZ);
for (int i = 0; i < 100; i++) {
// Test direction +X
if ((coordinates = getChunkCoordinates(pos.add(new Vect(10 * i, 0, 0)), player.worldObj, biomesToSearch, i < loadChunkDistance)) != null)
return coordinates;
// Test direction +X+Z
if ((coordinates = getChunkCoordinates(pos.add(new Vect(10 * i, 0, 10 * i)), player.worldObj, biomesToSearch, i < loadChunkDistance)) != null)
return coordinates;
// Test direction +X-Z
if ((coordinates = getChunkCoordinates(pos.add(new Vect(10 * i, 0, -10 * i)), player.worldObj, biomesToSearch, i < loadChunkDistance)) != null)
return coordinates;
// Test direction -X
if ((coordinates = getChunkCoordinates(pos.add(new Vect(-10 * i, 0, 0)), player.worldObj, biomesToSearch, i < loadChunkDistance)) != null)
return coordinates;
// Test direction -X+Z
if ((coordinates = getChunkCoordinates(pos.add(new Vect(-10 * i, 0, 10 * i)), player.worldObj, biomesToSearch, i < loadChunkDistance)) != null)
return coordinates;
// Test direction -X-Z
if ((coordinates = getChunkCoordinates(pos.add(new Vect(-10 * i, 0, -10 * i)), player.worldObj, biomesToSearch, i < loadChunkDistance)) != null)
return coordinates;
// Test direction +Z
if ((coordinates = getChunkCoordinates(pos.add(new Vect(0, 0, 10 * i)), player.worldObj, biomesToSearch, i < loadChunkDistance)) != null)
return coordinates;
// Test direction -Z
if ((coordinates = getChunkCoordinates(pos.add(new Vect(0, 0, -10 * i)), player.worldObj, biomesToSearch, i < loadChunkDistance)) != null)
return coordinates;
}
return coordinates;
}