diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/slaves/MaterialUtils_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/slaves/MaterialUtils_15.java index 26b8cf9b..d8a0df55 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/features/slaves/MaterialUtils_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/features/slaves/MaterialUtils_15.java @@ -20,6 +20,7 @@ package de.steamwar.bausystem.features.slaves; import lombok.experimental.UtilityClass; +import net.minecraft.server.v1_15_R1.WorldGenVines; import org.bukkit.Material; import java.util.Arrays; @@ -31,6 +32,9 @@ public class MaterialUtils_15 { private static Set unpushable = new HashSet<>(Arrays.asList(Material.BARRIER, Material.BEACON, Material.COMMAND_BLOCK, Material.CHAIN_COMMAND_BLOCK, Material.REPEATING_COMMAND_BLOCK, Material.ENCHANTING_TABLE, Material.END_GATEWAY, Material.END_PORTAL, Material.ENDER_CHEST, Material.GRINDSTONE, Material.JIGSAW, Material.JUKEBOX, Material.NETHER_PORTAL, Material.OBSIDIAN, Material.STRUCTURE_VOID, Material.BARREL, Material.BEEHIVE, Material.BEE_NEST, Material.BLAST_FURNACE, Material.BREWING_STAND, Material.CHEST, Material.DAYLIGHT_DETECTOR, Material.DISPENSER, Material.DROPPER, Material.FURNACE, Material.HOPPER, Material.LECTERN, Material.SMOKER, Material.TRAPPED_CHEST)); + // TODO: FLOWER + private static Set breaking = new HashSet<>(Arrays.asList(Material.BAMBOO, Material.CACTUS, Material.CAKE, Material.CARVED_PUMPKIN, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.COBWEB, Material.COCOA, Material.DRAGON_EGG, Material.FIRE, Material.FLOWER_POT, Material.JACK_O_LANTERN, Material.LADDER, Material.LAVA, Material.LAVA, Material.LEVER, Material.LILY_PAD, Material.MELON, Material.NETHER_WART, Material.PUMPKIN, Material.COMPARATOR, Material.REDSTONE_WIRE, Material.REPEATER, Material.TORCH, Material.STRUCTURE_VOID, Material.SCAFFOLDING, Material.SEA_PICKLE, Material.SNOW, Material.SUGAR_CANE, Material.TORCH, Material.TRIPWIRE, Material.TRIPWIRE_HOOK, Material.TURTLE_EGG, Material.VINE, Material.WATER, Material.WHEAT)); + static boolean isUnpusheable(Material material) { if (unpushable.contains(material)) { return true; @@ -38,4 +42,12 @@ public class MaterialUtils_15 { String name = material.name(); return name.contains("BANNER") || name.contains("SIGN"); } + + static boolean isBreakingOnPush(Material material) { + if (breaking.contains(material)) { + return true; + } + String name = material.name(); + return name.contains("BED") || name.contains("BUTTON") || name.contains("CARPET") || (name.contains("DOOR") && !name.contains("TRAPDOOR")) || name.contains("HEAD") || name.contains("LEAVES") || name.contains("MUSHROOM") || name.contains("PRESSURE_PLATE") || name.contains("SHULKER_BOX"); + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/MaterialUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/MaterialUtils.java index 4ff1695f..35c27649 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/MaterialUtils.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/MaterialUtils.java @@ -29,4 +29,10 @@ public class MaterialUtils { new VersionedCallable<>(() -> MaterialUtils_15.isUnpusheable(material), 15) ); } + + public static boolean isBreakingOnPush(Material material) { + return VersionedCallable.call( + new VersionedCallable<>(() -> MaterialUtils_15.isBreakingOnPush(material), 15) + ); + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java index 68349d6f..de5c04f2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java @@ -49,6 +49,9 @@ public class PistonLine implements PanzernAlgorithm { if (MaterialUtils.isUnpusheable(relativeBlock.getType())) { break; } + if (MaterialUtils.isBreakingOnPush(relativeBlock.getType())) { + break; + } continue; } Piston piston = (Piston) blockData;