Search in sources :

Example 1 with MessageWirelessSaveFreq

use of com.bluepowermod.network.message.MessageWirelessSaveFreq in project BluePower by Qmunity.

the class GuiGateWireless method actionPerformed.

@Override
public void actionPerformed(IGuiWidget widget) {
    super.actionPerformed(widget);
    if (widget == filterAccessLevel) {
        if (filterAccessLevel.value == 3 && !Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) {
            filterAccessLevel.value++;
        }
        if (selected != null && !selected.equals(gate.getFrequency())) {
            frequencyName.setText("");
            filter = "";
        }
        selected = null;
    }
    if (widget == modeSelector)
        sendToServer(0, modeSelector.value);
    if (widget == addFrequency)
        BPNetworkHandler.INSTANCE.sendToServer(new MessageWirelessNewFreq(gate, acc, frequencyName.getText().trim(), gate.isBundled()));
    if (widget == saveFrequency) {
        BPNetworkHandler.INSTANCE.sendToServer(new MessageWirelessSaveFreq(selected, acc, frequencyName.getText().trim()));
        filter = "";
    }
    if (widget == removeFrequency) {
        if (gate.getFrequency() != null && (selected == null || selected.equals(gate.getFrequency()))) {
            sendToServer(1, 0);
        } else if (selected != null) {
            BPNetworkHandler.INSTANCE.sendToServer(new MessageWirelessRemoveFreq(selected));
            selected = null;
        }
    }
    if (widget == accessLevel) {
        acc = Accessibility.values()[accessLevel.value];
    }
}
Also used : MessageWirelessRemoveFreq(com.bluepowermod.network.message.MessageWirelessRemoveFreq) MessageWirelessNewFreq(com.bluepowermod.network.message.MessageWirelessNewFreq) MessageWirelessSaveFreq(com.bluepowermod.network.message.MessageWirelessSaveFreq)

Aggregations

MessageWirelessNewFreq (com.bluepowermod.network.message.MessageWirelessNewFreq)1 MessageWirelessRemoveFreq (com.bluepowermod.network.message.MessageWirelessRemoveFreq)1 MessageWirelessSaveFreq (com.bluepowermod.network.message.MessageWirelessSaveFreq)1