use of powercrystals.minefactoryreloaded.api.rednet.IRedNetNoConnection in project MineFactoryReloaded by powercrystals.
the class TileEntityRedNetCable method getConnectionState.
public RedNetConnectionType getConnectionState(ForgeDirection side) {
BlockPosition bp = new BlockPosition(this);
bp.orientation = side;
bp.moveForwards(1);
int blockId = worldObj.getBlockId(bp.x, bp.y, bp.z);
Block b = Block.blocksList[blockId];
if (// block doesn't exist (air) - never connect
b == null) {
return RedNetConnectionType.None;
} else if (// cables - always connect
blockId == MineFactoryReloadedCore.rednetCableBlock.blockID) {
return RedNetConnectionType.CableAll;
} else if (// cable-only, and not a cable - don't connct
_mode == 2) {
return RedNetConnectionType.None;
} else if (b instanceof IRedNetNoConnection) {
return RedNetConnectionType.None;
} else if (// API node - let them figure it out
b instanceof IConnectableRedNet) {
return ((IConnectableRedNet) b).getConnectionType(worldObj, bp.x, bp.y, bp.z, side.getOpposite());
} else if (_mode == 0 && (blockId <= _maxVanillaBlockId && !_connectionWhitelist.contains(blockId)) || _connectionBlackList.contains(blockId) || b.isAirBlock(worldObj, bp.x, bp.y, bp.z)) // standard connection logic, then figure out if we shouldn't connect
// mode 1 will skip this
{
return RedNetConnectionType.None;
} else if (// mode 1 forces plate mode for weak power
_mode == 0 && b.isBlockSolidOnSide(worldObj, bp.x, bp.y, bp.z, side.getOpposite())) {
return RedNetConnectionType.CableSingle;
} else {
return RedNetConnectionType.PlateSingle;
}
}
Aggregations