From a6aaa9538f3ef516a8b1347c2572dab079d89853 Mon Sep 17 00:00:00 2001 From: Traks <58818927+traksag@users.noreply.github.com> Date: Sat, 30 Apr 2022 14:16:58 +0200 Subject: [PATCH] Set plot biome chunk by chunk (#3590) * Actually set plot biome chunk by chunk * Better variable name for chunk position --- .../plotsquared/core/util/RegionManager.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java index 45ed7e4c4..01542ead5 100644 --- a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java @@ -409,13 +409,26 @@ public abstract class RegionManager { ) { final QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(area.getWorldName())); 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( area.getWorldName(), - region, + chunkRegion, biome ); - worldUtil.refreshChunk(blockVector2.getBlockX(), blockVector2.getBlockZ(), area.getWorldName()); + worldUtil.refreshChunk(chunkPos.getBlockX(), chunkPos.getBlockZ(), area.getWorldName()); }); queue.setCompleteTask(whenDone); queue.enqueue();