Search in sources :

Example 6 with Frequency

use of com.bluepowermod.part.gate.wireless.Frequency in project BluePower by Qmunity.

the class MessageWirelessSaveFreq method read.

@Override
public void read(DataInput buffer) throws IOException {
    freq = new Frequency();
    freq.readFromBuffer(buffer);
    freq = (Frequency) WirelessManager.COMMON_INSTANCE.getFrequency(freq.getAccessibility(), freq.getFrequencyName(), freq.getOwner());
    freq.setAccessibility(Accessibility.values()[buffer.readInt()]);
    freq.setFrequency(buffer.readUTF());
}
Also used : Frequency(com.bluepowermod.part.gate.wireless.Frequency)

Example 7 with Frequency

use of com.bluepowermod.part.gate.wireless.Frequency in project BluePower by Qmunity.

the class MessageWirelessFrequencySync method read.

@Override
public void read(DataInput buffer) throws IOException {
    int amt = buffer.readInt();
    for (int i = 0; i < amt; i++) {
        Frequency f = new Frequency();
        f.readFromBuffer(buffer);
        frequencies.add(f);
    }
}
Also used : Frequency(com.bluepowermod.part.gate.wireless.Frequency) IFrequency(com.bluepowermod.api.wireless.IFrequency)

Example 8 with Frequency

use of com.bluepowermod.part.gate.wireless.Frequency in project BluePower by Qmunity.

the class MessageWirelessNewFreq method handleServerSide.

@Override
public void handleServerSide(EntityPlayer player) {
    Frequency freq = (Frequency) WirelessManager.COMMON_INSTANCE.registerFrequency(player, name, acc, bundled);
    ITilePartHolder h = MultipartCompatibility.getPartHolder(player.worldObj, x, y, z);
    if (h == null)
        return;
    IWirelessGate p = null;
    for (IPart pa : h.getParts()) if (pa instanceof IWirelessGate && ((IWirelessGate) pa).getFace() == face)
        p = (IWirelessGate) pa;
    if (p == null)
        return;
    p.setFrequency(freq);
    BPNetworkHandler.INSTANCE.sendTo(new MessageWirelessFrequencySync(player), (EntityPlayerMP) player);
}
Also used : ITilePartHolder(uk.co.qmunity.lib.part.ITilePartHolder) IPart(uk.co.qmunity.lib.part.IPart) IWirelessGate(com.bluepowermod.part.gate.wireless.IWirelessGate) Frequency(com.bluepowermod.part.gate.wireless.Frequency)

Aggregations

Frequency (com.bluepowermod.part.gate.wireless.Frequency)8 IFrequency (com.bluepowermod.api.wireless.IFrequency)5 MessageWirelessNewFreq (com.bluepowermod.network.message.MessageWirelessNewFreq)1 IWirelessGate (com.bluepowermod.part.gate.wireless.IWirelessGate)1 WirelessManager (com.bluepowermod.part.gate.wireless.WirelessManager)1 ArrayList (java.util.ArrayList)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 IPart (uk.co.qmunity.lib.part.IPart)1 ITilePartHolder (uk.co.qmunity.lib.part.ITilePartHolder)1