SteamWar/BauSystem2.0
Archiviert
12
0

Fix edge cases in PowerableActivation and SmartPlaceListener while placing hopper on an inventory holder
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-10-08 16:50:27 +02:00
Ursprung 614f697900
Commit 4dc0170bad
2 geänderte Dateien mit 6 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -41,17 +41,20 @@ public class PowerableActivation implements PanzernAlgorithm {
public PanzernResult check(Block source, Map<BlockFace, Block> adjacent, Set<Material> adjacentMaterials) { public PanzernResult check(Block source, Map<BlockFace, Block> adjacent, Set<Material> adjacentMaterials) {
int powered = 0; int powered = 0;
int powerable = 0; int powerable = 0;
for (BlockFace blockFace : HORIZONTAL_FACES) { for (BlockFace blockFace : BLOCK_FACES) {
if (!adjacent.containsKey(blockFace)) { if (!adjacent.containsKey(blockFace)) {
continue; continue;
} }
Block block = adjacent.get(blockFace); Block block = adjacent.get(blockFace);
if (block.getBlockData() instanceof Powerable || block.getBlockData() instanceof AnaloguePowerable && block.getType() != Material.OBSERVER) { if ((block.getType() == Material.HOPPER || block.getBlockData() instanceof Powerable || block.getBlockData() instanceof AnaloguePowerable) && block.getType() != Material.OBSERVER) {
powerable++; powerable++;
} }
if (block.getType() == Material.TNT) { if (block.getType() == Material.TNT) {
powerable++; powerable++;
} }
if (blockFace == BlockFace.DOWN || blockFace == BlockFace.UP) {
continue;
}
switch (block.getType()) { switch (block.getType()) {
case REDSTONE_WIRE: case REDSTONE_WIRE:
RedstoneWire redstoneWire = (RedstoneWire) block.getBlockData(); RedstoneWire redstoneWire = (RedstoneWire) block.getBlockData();

Datei anzeigen

@ -96,7 +96,7 @@ public class SmartPlaceListener implements Listener {
return; return;
} }
if (event.getClickedBlock().getType() == event.getMaterial()) { if (event.getClickedBlock().getType() == event.getMaterial() || event.getMaterial() == Material.HOPPER) {
if (!(event.getClickedBlock().getState() instanceof InventoryHolder)) { if (!(event.getClickedBlock().getState() instanceof InventoryHolder)) {
return; return;
} }