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());
}
}
Aggregations