Search in sources :

Example 1 with SingleWorldGenerator

use of com.plotsquared.core.generator.SingleWorldGenerator in project PlotSquared by IntellectualSites.

the class BukkitPlotGenerator method generateChunkData.

@Override
@NonNull
public ChunkData generateChunkData(@NonNull World world, @NonNull Random random, int x, int z, @NonNull BiomeGrid biome) {
    int minY = BukkitWorld.getMinWorldHeight(world);
    int maxY = BukkitWorld.getMaxWorldHeight(world);
    GenChunk result = new GenChunk(minY, maxY);
    if (this.getPlotGenerator() instanceof SingleWorldGenerator) {
        if (result.getChunkData() != null) {
            for (int chunkX = 0; chunkX < 16; chunkX++) {
                for (int chunkZ = 0; chunkZ < 16; chunkZ++) {
                    for (int y = minY; y < maxY; y++) {
                        biome.setBiome(chunkX, y, chunkZ, Biome.PLAINS);
                    }
                }
            }
            return result.getChunkData();
        }
    }
    // Set the chunk location
    result.setChunk(new ChunkWrapper(world.getName(), x, z));
    // Set the result data
    result.setChunkData(createChunkData(world));
    result.biomeGrid = biome;
    result.result = null;
    // Catch any exceptions (as exceptions usually thrown)
    try {
        // Fill the result data if necessary
        if (this.platformGenerator != this) {
            return this.platformGenerator.generateChunkData(world, random, x, z, biome);
        } else {
            generate(BlockVector2.at(x, z), world, result);
        }
    } catch (Throwable e) {
        e.printStackTrace();
    }
    // Return the result data
    return result.getChunkData();
}
Also used : GenChunk(com.plotsquared.bukkit.queue.GenChunk) SingleWorldGenerator(com.plotsquared.core.generator.SingleWorldGenerator) ChunkWrapper(com.plotsquared.core.location.ChunkWrapper) NonNull(org.checkerframework.checker.nullness.qual.NonNull)

Aggregations

GenChunk (com.plotsquared.bukkit.queue.GenChunk)1 SingleWorldGenerator (com.plotsquared.core.generator.SingleWorldGenerator)1 ChunkWrapper (com.plotsquared.core.location.ChunkWrapper)1 NonNull (org.checkerframework.checker.nullness.qual.NonNull)1