From e45b2ba288dd369c5f6798e4206264caabd6c7f1 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 7 Feb 2022 00:02:27 +0000 Subject: [PATCH] Address inclusivity issues for max world height --- .../com/plotsquared/bukkit/generator/BlockStatePopulator.java | 2 +- .../com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java | 2 +- .../src/main/java/com/plotsquared/bukkit/queue/GenChunk.java | 2 +- .../main/java/com/plotsquared/bukkit/util/BukkitWorld.java | 2 +- .../src/main/java/com/plotsquared/bukkit/util/ContentMap.java | 2 +- .../main/java/com/plotsquared/core/generator/HybridUtils.java | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java index 240b48159..9574a2fc8 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BlockStatePopulator.java @@ -67,7 +67,7 @@ final class BlockStatePopulator extends BlockPopulator { 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) + com.plotsquared.bukkit.util.BukkitWorld.getMaxWorldHeight(world) - 1 ); if (this.plotGenerator.populateChunk(chunk, area)) { this.queue.enqueue(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java index e104b80e8..d580719ce 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java @@ -134,7 +134,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { int sx = blockVector2.getX() << 4; int sz = blockVector2.getZ() << 4; if (isRegenChunk) { - for (int layer = (getWorld().getMinY() >> 4); layer < (getWorld().getMaxY() >> 4); layer++) { + for (int layer = (getWorld().getMinY() >> 4); layer <= (getWorld().getMaxY() >> 4); layer++) { for (int y = 0; y < 16; y++) { for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java index 9c20d0c6d..1fab185c3 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java @@ -172,7 +172,7 @@ public class GenChunk extends ScopedQueueCoordinator { */ public boolean setBiome(int x, int z, @NonNull Biome biome) { if (this.biomeGrid != null) { - for (int y = getMin().getY(); y < getMax().getY(); y++) { + for (int y = getMin().getY(); y <= getMax().getY(); y++) { this.setBiome(x, y, z, biome); } return true; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitWorld.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitWorld.java index 0f2ed2556..1f8045f7d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitWorld.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitWorld.java @@ -120,7 +120,7 @@ public class BukkitWorld implements World { @Override public int getMaxHeight() { - return getMaxWorldHeight(world); + return getMaxWorldHeight(world) - 1; } @Override diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java index 542557492..0a9130e0c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java @@ -135,7 +135,7 @@ public class ContentMap { } private void saveBlocks(BukkitWorld world, int x, int z, int offsetX, int offsetZ) { - BaseBlock[] ids = new BaseBlock[world.getMaxY() - world.getMinY()]; + BaseBlock[] ids = new BaseBlock[world.getMaxY() - world.getMinY() + 1]; for (short yIndex = 0; yIndex <= world.getMaxY() - world.getMinY(); yIndex++) { BaseBlock block = world.getFullBlock(BlockVector3.at(x, yIndex + world.getMinY(), z)); ids[yIndex] = block; diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java b/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java index 74e86afaa..9e33ae70d 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java @@ -215,8 +215,8 @@ public class HybridUtils { int xx = chunkBlockX + x; for (int z = minZ; z <= maxZ; z++) { int zz = chunkBlockZ + z; - for (int yIndex = 0; yIndex < minHeight; yIndex++) { - int y = yIndex - minHeight; + for (int yIndex = 0; yIndex < height; yIndex++) { + int y = yIndex + minHeight; BlockState block = queue.getBlock(xx, y, zz); int xr = xb + x; int zr = zb + z;