From 773d53e93a22b57013aa29f0d23edfee61fb3ebd Mon Sep 17 00:00:00 2001 From: aidancbrady Date: Wed, 13 Jul 2016 17:07:02 -0400 Subject: [PATCH] Fixed Logistical Transporter network pathfinding --- .../multipart/MultipartTransmitter.java | 2 +- .../multipart/PartLogisticalTransporter.java | 3 +- .../common/util/TransporterUtils.java | 90 ------------------- 3 files changed, 2 insertions(+), 93 deletions(-) diff --git a/src/main/java/mekanism/common/multipart/MultipartTransmitter.java b/src/main/java/mekanism/common/multipart/MultipartTransmitter.java index f05741c06..970043090 100644 --- a/src/main/java/mekanism/common/multipart/MultipartTransmitter.java +++ b/src/main/java/mekanism/common/multipart/MultipartTransmitter.java @@ -55,7 +55,7 @@ public class MultipartTransmitter> extends Tran { IGridTransmitter transmitter = ((ITransmitterTile)potentialTransmitterTile).getTransmitter(); - if(TransmissionType.checkTransmissionType(transmitter, getTransmissionType())) + if(TransmissionType.checkTransmissionType(transmitter, getTransmissionType()) && containingPart.isValidTransmitter(potentialTransmitterTile)) { return sideCoord; } diff --git a/src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java b/src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java index fa78dfbd3..3b0a16f82 100644 --- a/src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java +++ b/src/main/java/mekanism/common/multipart/PartLogisticalTransporter.java @@ -383,8 +383,7 @@ public class PartLogisticalTransporter extends PartTransmitter colors = ListUtils.asList(EnumColor.DARK_BLUE, EnumColor.DARK_GREEN, EnumColor.DARK_AQUA, EnumColor.DARK_RED, EnumColor.PURPLE, EnumColor.INDIGO, EnumColor.BRIGHT_GREEN, EnumColor.AQUA, EnumColor.RED, EnumColor.PINK, EnumColor.YELLOW, EnumColor.BLACK); - /** - * Gets all the transporters around a tile entity. - * @param tileEntity - center tile entity - * @return array of TileEntities - */ - public static ILogisticalTransporter[] getConnectedTransporters(ILogisticalTransporter tileEntity) - { - ILogisticalTransporter[] transporters = new ILogisticalTransporter[] {null, null, null, null, null, null}; - - for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) - { - TileEntity tile = tileEntity.coord().getFromSide(orientation).getTileEntity(tileEntity.world()); - - if(tile instanceof ITransporterTile) - { - ILogisticalTransporter otherTransporter = ((ITransporterTile)tile).getTransmitter(); - - if(otherTransporter.getColor() == null || tileEntity.getColor() == null || otherTransporter.getColor() == tileEntity.getColor()) - { - transporters[orientation.ordinal()] = otherTransporter; - } - } - } - - return transporters; - } - public static boolean isValidAcceptorOnSide(TileEntity tile, ForgeDirection side) { if(tile instanceof ITransmitterTile || !(tile instanceof IInventory)) @@ -76,68 +48,6 @@ public final class TransporterUtils return false; } - /** - * Gets all the adjacent connections to a TileEntity. - * @param transporter - center TileEntity - * @return boolean[] of adjacent connections - */ - public static boolean[] getConnections(ILogisticalTransporter transporter) - { - boolean[] connectable = new boolean[] {false, false, false, false, false, false}; - - ILogisticalTransporter[] connectedTransporters = getConnectedTransporters(transporter); - IInventory[] connectedInventories = getConnectedInventories(transporter); - - for(IInventory inventory : connectedInventories) - { - if(inventory != null) - { - int side = Arrays.asList(connectedInventories).indexOf(inventory); - - if(!transporter.canConnect(ForgeDirection.getOrientation(side))) - { - continue; - } - - ForgeDirection forgeSide = ForgeDirection.getOrientation(side).getOpposite(); - - if(inventory.getSizeInventory() > 0) - { - if(inventory instanceof ISidedInventory) - { - ISidedInventory sidedInventory = (ISidedInventory)inventory; - - if(sidedInventory.getAccessibleSlotsFromSide(forgeSide.ordinal()) != null) - { - if(sidedInventory.getAccessibleSlotsFromSide(forgeSide.ordinal()).length > 0) - { - connectable[side] = true; - } - } - } - else { - connectable[side] = true; - } - } - } - } - - for(ILogisticalTransporter trans : connectedTransporters) - { - if(trans != null) - { - int side = Arrays.asList(connectedTransporters).indexOf(trans); - - if(transporter.canConnectMutual(ForgeDirection.getOrientation(side))) - { - connectable[side] = true; - } - } - } - - return connectable; - } - /** * Gets all the inventories around a tile entity. * @param transporter - center tile entity