if (event.phase == Phase.END) {
ArrayDeque<RetroChunkCoord> chunks = chunksToGen.get(dim);
if (chunks != null && chunks.size() > 0) {
RetroChunkCoord r = chunks.pollFirst();
ChunkCoord c = r.coord;
CoFHCore.log.info("RetroGening " + c.toString() + ".");
long worldSeed = world.getSeed();
Random rand = new Random(worldSeed);
long xSeed = rand.nextLong() >> 2 + 1L;
long zSeed = rand.nextLong() >> 2 + 1L;
rand.setSeed(xSeed * c.chunkX + zSeed * c.chunkZ ^ worldSeed);
WorldHandler.instance.generateWorld(rand, r, world, false);
chunksToGen.put(dim, chunks);
} else if (chunks != null) {
chunksToGen.remove(dim);
}
} else {
ArrayDeque<ChunkCoord> chunks = chunksToPreGen.get(dim);
if (chunks != null && chunks.size() > 0) {
ChunkCoord c = chunks.pollFirst();
CoFHCore.log.info("PreGening " + c.toString() + ".");
world.getChunkFromChunkCoords(c.chunkX, c.chunkZ);
} else if (chunks != null) {
chunksToPreGen.remove(dim);
}
}