use of gregtech.api.util.GTWorldGen in project GregTech by GregTechCE.
the class WorldGenerator method generate.
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
synchronized (this) {
if (!sorted) {
GregTechAPI.worldgenList.sort(GTWorldGen::compareTo);
sorted = true;
}
}
Random rnd = new XSTR();
Biome biome = world.getBiome(new BlockPos(chunkX << 4, 64, chunkZ << 4));
HashSet<ChunkPos> centers = new HashSet<>();
int maxRange = (GTWorldGenOreVein.getMaxOreVeinSize(world) + 15) >> 4;
if (maxRange > 0) {
for (int i = -maxRange; i <= maxRange; i++) {
for (int j = -maxRange; j <= maxRange; j++) {
centers.add(new ChunkPos(getVeinCenterCoordinate(chunkX + i), getVeinCenterCoordinate(chunkZ + j)));
}
}
centers.forEach(pos -> generateOreLayerAt(chunkX, chunkZ, pos.x, pos.z, world, biome, chunkGenerator, chunkProvider));
}
for (GTWorldGen worldgen : GregTechAPI.worldgenList) {
try {
worldgen.generate(rnd, chunkX, chunkZ, world, biome, chunkGenerator, chunkProvider);
} catch (Exception e) {
GTLog.logger.catching(e);
}
}
}