Address inclusivity issues for max world height

This commit is contained in:
dordsor21 2022-02-07 00:02:27 +00:00 committed by Jordan
parent f45fb8fd6f
commit e45b2ba288
6 changed files with 7 additions and 7 deletions

View File

@ -67,7 +67,7 @@ final class BlockStatePopulator extends BlockPopulator {
final ChunkWrapper wrap = new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ()); final ChunkWrapper wrap = new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ());
final ScopedQueueCoordinator chunk = this.queue.getForChunk(wrap.x, wrap.z, final ScopedQueueCoordinator chunk = this.queue.getForChunk(wrap.x, wrap.z,
com.plotsquared.bukkit.util.BukkitWorld.getMinWorldHeight(world), 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)) { if (this.plotGenerator.populateChunk(chunk, area)) {
this.queue.enqueue(); this.queue.enqueue();

View File

@ -134,7 +134,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
int sx = blockVector2.getX() << 4; int sx = blockVector2.getX() << 4;
int sz = blockVector2.getZ() << 4; int sz = blockVector2.getZ() << 4;
if (isRegenChunk) { 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 y = 0; y < 16; y++) {
for (int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {

View File

@ -172,7 +172,7 @@ public class GenChunk extends ScopedQueueCoordinator {
*/ */
public boolean setBiome(int x, int z, @NonNull Biome biome) { public boolean setBiome(int x, int z, @NonNull Biome biome) {
if (this.biomeGrid != null) { 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); this.setBiome(x, y, z, biome);
} }
return true; return true;

View File

@ -120,7 +120,7 @@ public class BukkitWorld implements World<org.bukkit.World> {
@Override @Override
public int getMaxHeight() { public int getMaxHeight() {
return getMaxWorldHeight(world); return getMaxWorldHeight(world) - 1;
} }
@Override @Override

View File

@ -135,7 +135,7 @@ public class ContentMap {
} }
private void saveBlocks(BukkitWorld world, int x, int z, int offsetX, int offsetZ) { 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++) { for (short yIndex = 0; yIndex <= world.getMaxY() - world.getMinY(); yIndex++) {
BaseBlock block = world.getFullBlock(BlockVector3.at(x, yIndex + world.getMinY(), z)); BaseBlock block = world.getFullBlock(BlockVector3.at(x, yIndex + world.getMinY(), z));
ids[yIndex] = block; ids[yIndex] = block;

View File

@ -215,8 +215,8 @@ public class HybridUtils {
int xx = chunkBlockX + x; int xx = chunkBlockX + x;
for (int z = minZ; z <= maxZ; z++) { for (int z = minZ; z <= maxZ; z++) {
int zz = chunkBlockZ + z; int zz = chunkBlockZ + z;
for (int yIndex = 0; yIndex < minHeight; yIndex++) { for (int yIndex = 0; yIndex < height; yIndex++) {
int y = yIndex - minHeight; int y = yIndex + minHeight;
BlockState block = queue.getBlock(xx, y, zz); BlockState block = queue.getBlock(xx, y, zz);
int xr = xb + x; int xr = xb + x;
int zr = zb + z; int zr = zb + z;