use of com.plotsquared.core.location.ChunkWrapper 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();
}
use of com.plotsquared.core.location.ChunkWrapper in project PlotSquared by IntellectualSites.
the class BlockStatePopulator method populate.
@Override
public void populate(@NonNull final World world, @NonNull final Random random, @NonNull final Chunk source) {
if (this.queue == null) {
this.queue = PlotSquared.platform().globalBlockQueue().getNewQueue(new BukkitWorld(world));
}
final PlotArea area = this.plotAreaManager.getPlotArea(world.getName(), null);
if (area == null) {
return;
}
final ChunkWrapper wrap = new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ());
final ScopedQueueCoordinator chunk = this.queue.getForChunk(wrap.x, wrap.z, com.plotsquared.bukkit.util.BukkitWorld.getMinWorldHeight(world), com.plotsquared.bukkit.util.BukkitWorld.getMaxWorldHeight(world) - 1);
if (this.plotGenerator.populateChunk(chunk, area)) {
this.queue.enqueue();
}
}
Aggregations