Search in sources :

Example 1 with IWirelessDevice

use of com.bluepowermod.api.wireless.IWirelessDevice in project BluePower by Qmunity.

the class Frequency method writeToBuffer.

public void writeToBuffer(DataOutput buf) throws IOException {
    buf.writeInt(accessibility.ordinal());
    buf.writeUTF(owner.toString());
    buf.writeUTF(ownerName.toString());
    buf.writeUTF(frequency.toString());
    buf.writeBoolean(isBundled());
    int amt = 0;
    for (IWirelessDevice d : WirelessManager.COMMON_INSTANCE.getDevices()) if (d.getFrequency() != null && d.getFrequency().equals(this))
        amt++;
    buf.writeInt(amt);
}
Also used : IWirelessDevice(com.bluepowermod.api.wireless.IWirelessDevice)

Example 2 with IWirelessDevice

use of com.bluepowermod.api.wireless.IWirelessDevice 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)

Example 3 with IWirelessDevice

use of com.bluepowermod.api.wireless.IWirelessDevice in project BluePower by Qmunity.

the class WirelessManager method unregisterFrequency.

@Override
public void unregisterFrequency(IFrequency frequency) {
    frequencies.remove(frequency);
    redstoneFrequencies.remove(frequency);
    bundledFrequencies.remove(frequency);
    for (IWirelessDevice d : devices) if (d.getFrequency() != null && d.getFrequency().equals(frequency))
        d.setFrequency(null);
}
Also used : IWirelessDevice(com.bluepowermod.api.wireless.IWirelessDevice)

Aggregations

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