Set plot biome chunk by chunk (#3590)

* Actually set plot biome chunk by chunk

* Better variable name for chunk position
This commit is contained in:
Traks 2022-04-30 14:16:58 +02:00 committed by GitHub
parent 0974fb2834
commit a6aaa9538f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -409,13 +409,26 @@ public abstract class RegionManager {
) { ) {
final QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(area.getWorldName())); final QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(area.getWorldName()));
queue.addReadChunks(region.getChunks()); queue.addReadChunks(region.getChunks());
queue.setChunkConsumer(blockVector2 -> { final BlockVector3 regionMin = region.getMinimumPoint();
final BlockVector3 regionMax = region.getMaximumPoint();
queue.setChunkConsumer(chunkPos -> {
BlockVector3 chunkMin = BlockVector3.at(
Math.max(chunkPos.getX() << 4, regionMin.getBlockX()),
regionMin.getBlockY(),
Math.max(chunkPos.getZ() << 4, regionMin.getBlockZ())
);
BlockVector3 chunkMax = BlockVector3.at(
Math.min((chunkPos.getX() << 4) + 15, regionMax.getBlockX()),
regionMax.getBlockY(),
Math.min((chunkPos.getZ() << 4) + 15, regionMax.getBlockZ())
);
CuboidRegion chunkRegion = new CuboidRegion(region.getWorld(), chunkMin, chunkMax);
WorldUtil.setBiome( WorldUtil.setBiome(
area.getWorldName(), area.getWorldName(),
region, chunkRegion,
biome biome
); );
worldUtil.refreshChunk(blockVector2.getBlockX(), blockVector2.getBlockZ(), area.getWorldName()); worldUtil.refreshChunk(chunkPos.getBlockX(), chunkPos.getBlockZ(), area.getWorldName());
}); });
queue.setCompleteTask(whenDone); queue.setCompleteTask(whenDone);
queue.enqueue(); queue.enqueue();