use of com.bluepowermod.network.message.MessageWirelessNewFreq 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];
}
}
use of com.bluepowermod.network.message.MessageWirelessNewFreq in project BluePower by Qmunity.
the class GuiGateWireless method mouseClicked.
@Override
protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button);
frequencyName.mouseClicked(x, y, button);
if (x > frequencyName.xPosition && x < frequencyName.xPosition + frequencyName.width && y > frequencyName.yPosition && y < frequencyName.yPosition + frequencyName.height && button == 1) {
frequencyName.setText("");
if (selected == null)
filter = "";
}
List<Frequency> frequencies = getFrequencies();
if (x > guiLeft + 88 && x <= guiLeft + 88 + 133 - (frequencies.size() > 12 ? 11 : 0)) {
for (int i = 0; i < Math.min(frequencies.size(), 12); i++) {
Frequency f = frequencies.get(i + scrolled);
if (f.isBundled() == gate.isBundled()) {
int yPos = guiTop + 22 + 10 + 2 + (i * 12);
if (y > yPos && y < yPos + 11) {
if (button == 0) {
if (f.equals(selected)) {
BPNetworkHandler.INSTANCE.sendToServer(new MessageWirelessNewFreq(gate, f.getAccessibility(), f.getFrequencyName(), f.isBundled()));
} else {
selected = f;
frequencyName.setText(f.getFrequencyName());
accessLevel.value = (acc = f.getAccessibility()).ordinal();
}
} else if (button == 1) {
selected = null;
frequencyName.setText(filter);
}
return;
}
}
}
}
}
Aggregations