Search in sources :

Example 1 with Pair

use of uk.co.qmunity.lib.misc.Pair in project BluePower by Qmunity.

the class GateTransceiver method propagate.

@Override
public Collection<Entry<IConnection<IRedstoneDevice>, Boolean>> propagate(ForgeDirection fromSide) {
    List<Entry<IConnection<IRedstoneDevice>, Boolean>> l = new ArrayList<Entry<IConnection<IRedstoneDevice>, Boolean>>();
    if (frequency == null)
        return l;
    l.add(new Pair<IConnection<IRedstoneDevice>, Boolean>(getRedstoneConnectionCache().getConnectionOnSide(fromSide), false));
    for (IWirelessDevice d : WirelessManager.COMMON_INSTANCE.getDevices()) {
        if (d != this && d.getFrequency() != null && d.getFrequency().equals(getFrequency())) {
            if (d instanceof GateTransceiver) {
                IConnection<IRedstoneDevice> c = ((GateTransceiver) d).getRedstoneConnectionCache().getConnectionOnSide(((GateTransceiver) d).front().getForgeDirection());
                if (c != null)
                    l.add(new Pair<IConnection<IRedstoneDevice>, Boolean>(c, false));
            }
        }
    }
    return l;
}
Also used : Entry(java.util.Map.Entry) ArrayList(java.util.ArrayList) IConnection(com.bluepowermod.api.connect.IConnection) IRedstoneDevice(com.bluepowermod.api.wire.redstone.IRedstoneDevice) IWirelessDevice(com.bluepowermod.api.wireless.IWirelessDevice) Pair(uk.co.qmunity.lib.misc.Pair)

Aggregations

IConnection (com.bluepowermod.api.connect.IConnection)1 IRedstoneDevice (com.bluepowermod.api.wire.redstone.IRedstoneDevice)1 IWirelessDevice (com.bluepowermod.api.wireless.IWirelessDevice)1 ArrayList (java.util.ArrayList)1 Entry (java.util.Map.Entry)1 Pair (uk.co.qmunity.lib.misc.Pair)1