From f845ff4523796087abd5ae1e7e9d80c6b99d4425 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 28 Nov 2021 14:13:28 +0100 Subject: [PATCH] Fix Panzern Signed-off-by: yoyosource --- .../bausystem/features/slaves/panzern/Panzern.java | 5 +++++ .../bausystem/features/slaves/panzern/PanzernResult.java | 1 + .../features/slaves/panzern/algorithms/AdjacentHoney.java | 7 +++++++ .../features/slaves/panzern/algorithms/AdjacentSlime.java | 7 +++++++ 4 files changed, 20 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java index 021c20c5..cda31d41 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/Panzern.java @@ -58,6 +58,7 @@ public class Panzern { private BaseBlock blockType; private BaseBlock slabType; private static final BaseBlock jukeboxType = BlockTypes.JUKEBOX.getDefaultState().toBaseBlock(); + private static final BaseBlock hopperType = BlockTypes.HOPPER.getDefaultState().toBaseBlock(); private static final BaseBlock airType = BlockTypes.AIR.getDefaultState().toBaseBlock(); @Getter @@ -129,6 +130,10 @@ public class Panzern { currentBlock.setType(Material.JUKEBOX); editSession.getChangeSet().add(new BlockChange(BukkitAdapter.asBlockVector(currentBlock.getLocation()), airType, jukeboxType)); break; + case UNMOVABLE_SLAB: + currentBlock.setType(Material.HOPPER); + editSession.getChangeSet().add(new BlockChange(BukkitAdapter.asBlockVector(currentBlock.getLocation()), airType, hopperType)); + break; default: emptyBlocks.add(currentBlock.getLocation().toVector()); break; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernResult.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernResult.java index 74f7a24c..06db1e54 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernResult.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernResult.java @@ -23,6 +23,7 @@ public enum PanzernResult { EMPTY, SLAB, UNMOVABLE, + UNMOVABLE_SLAB, BLOCK, DEFAULT } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentHoney.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentHoney.java index 4703515a..aca57cd7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentHoney.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentHoney.java @@ -36,6 +36,13 @@ public class AdjacentHoney implements PanzernAlgorithm { @Override public PanzernResult check(Block source, Map adjacent, Set adjacentMaterials) { if (adjacentMaterials.contains(Material.HONEY_BLOCK)) { + if (adjacent.get(BlockFace.DOWN).getType() == Material.REDSTONE_WIRE) { + for (BlockFace face : HORIZONTAL_FACES) { + if (adjacent.get(face).getType() == Material.REDSTONE_WIRE) { + return PanzernResult.UNMOVABLE_SLAB; + } + } + } return PanzernResult.UNMOVABLE; } return PanzernResult.DEFAULT; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentSlime.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentSlime.java index 11523e5b..ff9ca4f6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentSlime.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/AdjacentSlime.java @@ -36,6 +36,13 @@ public class AdjacentSlime implements PanzernAlgorithm { @Override public PanzernResult check(Block source, Map adjacent, Set adjacentMaterials) { if (adjacentMaterials.contains(Material.SLIME_BLOCK)) { + if (adjacent.get(BlockFace.DOWN).getType() == Material.REDSTONE_WIRE) { + for (BlockFace face : HORIZONTAL_FACES) { + if (adjacent.get(face).getType() == Material.REDSTONE_WIRE) { + return PanzernResult.UNMOVABLE_SLAB; + } + } + } return PanzernResult.UNMOVABLE; } return PanzernResult.DEFAULT;