Search in sources :

Example 1 with Channel

use of crazypants.enderio.machine.transceiver.Channel in project LogisticsPipes by RS485.

the class EnderIOProxy method getConnectedTransceivers.

@Override
public List<TileEntity> getConnectedTransceivers(TileEntity tile) {
    TileTransceiver transceiver = (TileTransceiver) tile;
    List<TileEntity> tiles = new ArrayList<>();
    Object channel = transceiver.getRecieveChannels(ChannelType.ITEM).toArray()[0];
    for (TileTransceiver t : ServerChannelRegister.instance.getIterator((Channel) channel)) {
        if (t == transceiver) {
            continue;
        }
        Set<Channel> receiveChannels = t.getRecieveChannels(ChannelType.ITEM);
        Set<Channel> sendChannels = t.getSendChannels(ChannelType.ITEM);
        if (receiveChannels.size() == 1 && sendChannels.size() == 1 && channel.equals(receiveChannels.toArray()[0]) && channel.equals(sendChannels.toArray()[0])) {
            tiles.add(t);
        }
    }
    return tiles;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) SubChannel(crazypants.enderio.machine.hypercube.TileHyperCube.SubChannel) Channel(crazypants.enderio.machine.transceiver.Channel) ArrayList(java.util.ArrayList) TileTransceiver(crazypants.enderio.machine.transceiver.TileTransceiver)

Aggregations

SubChannel (crazypants.enderio.machine.hypercube.TileHyperCube.SubChannel)1 Channel (crazypants.enderio.machine.transceiver.Channel)1 TileTransceiver (crazypants.enderio.machine.transceiver.TileTransceiver)1 ArrayList (java.util.ArrayList)1 TileEntity (net.minecraft.tileentity.TileEntity)1