From d37f5b9aa8547bbacbce1890d4eb0f00cfe2c690 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Mon, 21 Jan 2019 09:53:04 +0100 Subject: [PATCH] Fix schematic pasting offsets --- .../plotsquared/plot/config/Settings.java | 5 +++++ .../plotsquared/plot/generator/HybridGen.java | 8 +++++++- .../plotsquared/plot/generator/HybridPlotWorld.java | 4 ++-- .../intellectualsites/plotsquared/plot/object/Plot.java | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java index f901744f8..0d5b74671 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Settings.java @@ -225,6 +225,11 @@ public class Settings extends Config { @Comment("Display scientific numbers (4.2E8)") public static boolean SCIENTIFIC = false; } + @Comment("Schematic Settings") public static final class Schematics { + @Comment("Whether schematic based generation should paste schematic on top of plots, or from Y=1") + public static boolean PASTE_ON_TOP = true; + } + @Comment("Configure the paths that will be used") public static final class Paths { public static String SCHEMATICS = "schematics"; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java index 886dd1125..f7e954a06 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridGen.java @@ -1,6 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.generator; import com.github.intellectualsites.plotsquared.plot.PlotSquared; +import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.MathMan; import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue; @@ -16,7 +17,12 @@ public class HybridGen extends IndependentPlotGenerator { private void placeSchem(HybridPlotWorld world, ScopedLocalBlockQueue result, short relativeX, short relativeZ, int x, int z) { - int minY = Math.min(world.PLOT_HEIGHT, world.ROAD_HEIGHT); + int minY; // Math.min(world.PLOT_HEIGHT, world.ROAD_HEIGHT); + if (Settings.Schematics.PASTE_ON_TOP) { + minY = Math.min(world.PLOT_HEIGHT, world.ROAD_HEIGHT); + } else { + minY = 1; + } BaseBlock[] blocks = world.G_SCH.get(MathMan.pair(relativeX, relativeZ)); if (blocks != null) { for (int y = 0; y < blocks.length; y++) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java index 4bed2c97a..0a722b4d6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/HybridPlotWorld.java @@ -156,13 +156,13 @@ public class HybridPlotWorld extends ClassicPlotWorld { if (w3 > PLOT_WIDTH || h3 > PLOT_WIDTH) { this.ROAD_SCHEMATIC_ENABLED = true; } - int centerShiftZ = 0; + int centerShiftZ; if (l3 < this.PLOT_WIDTH) { centerShiftZ = (this.PLOT_WIDTH - l3) / 2; } else { centerShiftZ = (PLOT_WIDTH - l3) / 2; } - int centerShiftX = 0; + int centerShiftX; if (w3 < this.PLOT_WIDTH) { centerShiftX = (this.PLOT_WIDTH - w3) / 2; } else { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index c57299bd8..83af645cf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java @@ -1443,7 +1443,7 @@ public class Plot { e.printStackTrace(); return true; } - SchematicHandler.manager.paste(sch, this, 0, 1, 0, false, new RunnableVal() { + SchematicHandler.manager.paste(sch, this, 0, 1, 0, Settings.Schematics.PASTE_ON_TOP, new RunnableVal() { @Override public void run(Boolean value) { if (value) { MainUtil.sendMessage(player, C.SCHEMATIC_PASTE_SUCCESS);