SteamWar/BauSystem2.0
Archiviert
12
0

Optimize imports PistonLine
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-11-11 21:12:36 +01:00
Ursprung ca3daa7ce6
Commit 58a67f5563
3 geänderte Dateien mit 21 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -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<Material> 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<Material> 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");
}
}

Datei anzeigen

@ -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)
);
}
}

Datei anzeigen

@ -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;