Search in sources :

Example 1 with IDuctHolder

use of cofh.thermaldynamics.duct.tiles.IDuctHolder in project LogisticsPipes by RS485.

the class TDDuctInformationProvider method canConnect.

@Override
public boolean canConnect(TileEntity to, EnumFacing direction, boolean ignoreSystemDisconnect) {
    TileEntity connection = CoordinateUtils.add(new DoubleCoordinates(duct.getPos()), direction).getTileEntity(duct.getWorld());
    if (duct.isSideBlocked((byte) direction.ordinal())) {
        return false;
    }
    if (!(connection instanceof IDuctHolder)) {
        return false;
    }
    DuctUnitItem connectedDuct = ((IDuctHolder) connection).getDuct(DuctToken.ITEMS);
    if (connectedDuct == null) {
        return false;
    } else if (connectedDuct instanceof LPDuctUnitItem) {
        return !((LPDuctUnitItem) connectedDuct).isLPBlockedSide(direction.getOpposite().ordinal(), ignoreSystemDisconnect);
    } else {
        return !connectedDuct.parent.isSideBlocked(direction.getOpposite().ordinal());
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IDuctHolder(cofh.thermaldynamics.duct.tiles.IDuctHolder) DuctUnitItem(cofh.thermaldynamics.duct.item.DuctUnitItem) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Aggregations

DuctUnitItem (cofh.thermaldynamics.duct.item.DuctUnitItem)1 IDuctHolder (cofh.thermaldynamics.duct.tiles.IDuctHolder)1 TileEntity (net.minecraft.tileentity.TileEntity)1 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)1