From d2a3483d31baf4a3425cc16a914a71679900a975 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sat, 4 Feb 2023 12:12:10 +0100 Subject: [PATCH] added check if it actually is a tb --- .../bausystem/utils/FlatteningWrapper15.java | 3 ++- .../bausystem/features/region/TestblockCommand.java | 2 +- .../de/steamwar/bausystem/region/PasteOptions.java | 2 ++ .../src/de/steamwar/bausystem/region/Region.java | 12 ++++++------ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java b/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java index 7cbe7348..b1d4ddf2 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java @@ -159,7 +159,8 @@ public class FlatteningWrapper15 implements FlatteningWrapper { public boolean test(BlockVector3 blockVector3) { BaseBlock block = clipboard.getFullBlock(blockVector3); String blockName = block.toString().toLowerCase(); - return !blockName.equals("minecraft:water") || blocks.contains(blockName); + if (pasteOptions.isTestBlock() && blockName.equals("minecraft.water")) return true; + return blocks.contains(blockName); } @Nullable diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java index a677e4df..8527371d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java @@ -86,7 +86,7 @@ public class TestblockCommand extends SWCommand { } try { - region.reset(node, RegionType.TESTBLOCK, regionExtensionType); + region.reset(node, RegionType.TESTBLOCK, regionExtensionType, true); RegionUtils.message(region, "REGION_TB_DONE"); } catch (IOException e) { BauSystem.MESSAGE.send("REGION_TB_ERROR", p); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/PasteOptions.java b/BauSystem_Main/src/de/steamwar/bausystem/region/PasteOptions.java index e28a02d8..c782a06b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/PasteOptions.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/PasteOptions.java @@ -67,4 +67,6 @@ public class PasteOptions { * Used in 1.15 */ private final int waterLevel; + + private final boolean testBlock; } \ No newline at end of file diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java index 2d3fdc04..2b518c87 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java @@ -425,8 +425,8 @@ public class Region { reset(null, regionType, regionExtensionType, false); } - public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType) throws IOException { - reset(schematic, regionType, regionExtensionType, false); + public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean isTestBlock) throws IOException { + reset(schematic, regionType, regionExtensionType, false, isTestBlock); } public void reset(File file) { @@ -435,11 +435,11 @@ public class Region { undoSessions.push(editSession); } - public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir) throws IOException { - reset(schematic, regionType, regionExtensionType, ignoreAir, false); + public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir, boolean isTestBlock) throws IOException { + reset(schematic, regionType, regionExtensionType, ignoreAir, false, isTestBlock); } - public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir, boolean onlyColors) throws IOException { + public void reset(SchematicNode schematic, RegionType regionType, RegionExtensionType regionExtensionType, boolean ignoreAir, boolean onlyColors, boolean isTestBlock) throws IOException { if (!hasReset(regionType)) { return; } @@ -447,7 +447,7 @@ public class Region { regionExtensionType = RegionExtensionType.NORMAL; } - PasteOptions pasteOptions = new PasteOptions((schematic != null && (schematic.getSchemtype().fightType() || schematic.getSchemtype().check())), ignoreAir, getPlain(Flag.COLOR, ColorMode.class).getColor(), onlyColors, regionExtensionType == RegionExtensionType.EXTENSION, getMinPoint(regionType, regionExtensionType), getMaxPoint(regionType, regionExtensionType), waterLevel); + PasteOptions pasteOptions = new PasteOptions((schematic != null && (schematic.getSchemtype().fightType() || schematic.getSchemtype().check())), ignoreAir, getPlain(Flag.COLOR, ColorMode.class).getColor(), onlyColors, regionExtensionType == RegionExtensionType.EXTENSION, getMinPoint(regionType, regionExtensionType), getMaxPoint(regionType, regionExtensionType), waterLevel, isTestBlock); Point pastePoint; File tempFile = null;