From be417ae954019d1e9daa86133ab8d87386443459 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 9 Feb 2022 14:00:15 +0000 Subject: [PATCH] Start generation at min gen height if bedrock is disabled --- .../plotsquared/core/generator/AugmentedUtils.java | 5 +++-- .../core/generator/ClassicPlotManager.java | 13 +++++++------ .../core/generator/HybridPlotManager.java | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java b/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java index 6830d0797..349d06b89 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java +++ b/Core/src/main/java/com/plotsquared/core/generator/AugmentedUtils.java @@ -122,6 +122,7 @@ public class AugmentedUtils { } QueueCoordinator secondaryMask; BlockState air = BlockTypes.AIR.getDefaultState(); + int startYOffset = !(area instanceof ClassicPlotWorld) || ((ClassicPlotWorld) area).PLOT_BEDROCK ? 1 : 0; if (area.getTerrain() == PlotAreaTerrainType.ROAD) { PlotManager manager = area.getPlotManager(); final boolean[][] canPlace = new boolean[16][16]; @@ -132,7 +133,7 @@ public class AugmentedUtils { int worldZ = z + blockZ; boolean can = manager.getPlotId(worldX, 0, worldZ) == null; if (can) { - for (int y = area.getMinGenHeight() + 1; y <= area.getMaxGenHeight(); y++) { + for (int y = area.getMinGenHeight() + startYOffset; y <= area.getMaxGenHeight(); y++) { queue.setBlock(worldX, y, worldZ, air); } canPlace[x][z] = true; @@ -149,7 +150,7 @@ public class AugmentedUtils { secondaryMask = primaryMask; for (int x = relativeBottomX; x <= relativeTopX; x++) { for (int z = relativeBottomZ; z <= relativeTopZ; z++) { - for (int y = area.getMinGenHeight() + 1; y <= area.getMaxGenHeight(); y++) { + for (int y = area.getMinGenHeight() + startYOffset; y <= area.getMaxGenHeight(); y++) { queue.setBlock(blockX + x, y, blockZ + z, air); } } diff --git a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java index f996807ed..44d8e33c0 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java @@ -150,7 +150,7 @@ public class ClassicPlotManager extends SquarePlotManager { classicPlotWorld, plot.getRegions(), blocks, - classicPlotWorld.getMinGenHeight() + 1, + classicPlotWorld.getMinGenHeight() + (classicPlotWorld.PLOT_BEDROCK ? 1 : 0), classicPlotWorld.getMaxGenHeight(), actor, queue @@ -211,7 +211,7 @@ public class ClassicPlotManager extends SquarePlotManager { classicPlotWorld, plot.getRegions(), blocks, - classicPlotWorld.getMinGenHeight() + 1, + classicPlotWorld.getMinGenHeight() + (classicPlotWorld.PLOT_BEDROCK ? 1 : 0), classicPlotWorld.PLOT_HEIGHT - 1, actor, queue @@ -386,10 +386,11 @@ public class ClassicPlotManager extends SquarePlotManager { } } + int startYOffset = classicPlotWorld.PLOT_BEDROCK ? 1 : 0; if (!plot.isMerged(Direction.NORTH)) { int z = bot.getZ(); for (int x = bot.getX(); x < top.getX(); x++) { - for (int y = classicPlotWorld.getMinGenHeight() + 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { + for (int y = classicPlotWorld.getMinGenHeight() + startYOffset; y <= classicPlotWorld.WALL_HEIGHT; y++) { queue.setBlock(x, y, z, blocks); } } @@ -397,7 +398,7 @@ public class ClassicPlotManager extends SquarePlotManager { if (!plot.isMerged(Direction.WEST)) { int x = bot.getX(); for (int z = bot.getZ(); z < top.getZ(); z++) { - for (int y = classicPlotWorld.getMinGenHeight() + 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { + for (int y = classicPlotWorld.getMinGenHeight() + startYOffset; y <= classicPlotWorld.WALL_HEIGHT; y++) { queue.setBlock(x, y, z, blocks); } } @@ -405,7 +406,7 @@ public class ClassicPlotManager extends SquarePlotManager { if (!plot.isMerged(Direction.SOUTH)) { int z = top.getZ(); for (int x = bot.getX(); x < top.getX() + (plot.isMerged(Direction.EAST) ? 0 : 1); x++) { - for (int y = classicPlotWorld.getMinGenHeight() + 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { + for (int y = classicPlotWorld.getMinGenHeight() + startYOffset; y <= classicPlotWorld.WALL_HEIGHT; y++) { queue.setBlock(x, y, z, blocks); } } @@ -413,7 +414,7 @@ public class ClassicPlotManager extends SquarePlotManager { if (!plot.isMerged(Direction.EAST)) { int x = top.getX(); for (int z = bot.getZ(); z < top.getZ() + (plot.isMerged(Direction.SOUTH) ? 0 : 1); z++) { - for (int y = classicPlotWorld.getMinGenHeight() + 1; y <= classicPlotWorld.WALL_HEIGHT; y++) { + for (int y = classicPlotWorld.getMinGenHeight() + startYOffset; y <= classicPlotWorld.WALL_HEIGHT; y++) { queue.setBlock(x, y, z, blocks); } } diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java index 2f8cc16ec..4fd62a40f 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java @@ -283,7 +283,7 @@ public class HybridPlotManager extends ClassicPlotManager { queue.setCuboid( pos1.withY(hybridPlotWorld.getMinGenHeight()), pos2.withY(hybridPlotWorld.getMinGenHeight()), - bedrock + hybridPlotWorld.PLOT_BEDROCK ? bedrock : filling ); // Each component has a different layer queue.setCuboid(