use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiThreeLogic method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
for (int i = 0; i < 8; i++) {
final int finalI = i;
ChoiceLabel tl = new ChoiceLabel(mc, this).addChoices("On", "Off", "Keep").setDesiredWidth(38).setDesiredHeight(14).setLayoutHint(new PositionalLayout.PositionalHint(146, 25 + i * 15));
tl.setChoiceTooltip("On", "Emit redstone signal");
tl.setChoiceTooltip("Off", "Don't emit redstone signal");
tl.setChoiceTooltip("Keep", "Keep previous redstone signal");
int state = tileEntity.getState(i);
switch(state) {
case 0:
tl.setChoice("Off");
break;
case 1:
tl.setChoice("On");
break;
default:
tl.setChoice("Keep");
break;
}
tl.addChoiceEvent((widget, s) -> {
String current = tl.getCurrentChoice();
int st = "On".equals(current) ? 1 : "Off".equals(current) ? 0 : -1;
sendServerCommand(RFToolsMessages.INSTANCE, ThreeLogicTileEntity.CMD_SETSTATE, new Argument("index", finalI), new Argument("state", st));
});
outputs.add(tl);
toplevel.addChild(tl);
}
toplevel.setBounds(new Rectangle(guiLeft, guiTop, LOGIC3_WIDTH, LOGIC3_HEIGHT));
window = new Window(this, toplevel);
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiRedstoneReceiver method setAnalog.
private void setAnalog() {
boolean analog = this.analog.isPressed();
tileEntity.setAnalog(analog);
sendServerCommand(RFToolsMessages.INSTANCE, RedstoneReceiverTileEntity.CMD_SETANALOG, new Argument("analog", analog));
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiScanner method changeRedstoneMode.
private void changeRedstoneMode() {
tileEntity.setRSMode(RedstoneMode.values()[redstoneMode.getCurrentChoiceIndex()]);
sendServerCommand(RFToolsMessages.INSTANCE, ScannerTileEntity.CMD_MODE, new Argument("rs", RedstoneMode.values()[redstoneMode.getCurrentChoiceIndex()].getDescription()));
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiScanner method move.
private void move(int x, int y, int z) {
BlockPos offset = tileEntity.getDataOffset();
int offsetX = offset.getX() + x;
int offsetY = offset.getY() + y;
int offsetZ = offset.getZ() + z;
sendServerCommand(network, ScannerTileEntity.CMD_SETOFFSET, new Argument("offsetX", offsetX), new Argument("offsetY", offsetY), new Argument("offsetZ", offsetZ));
}
use of mcjty.lib.network.Argument in project RFTools by McJty.
the class GuiSecurityManager method updateChannelName.
private void updateChannelName() {
// Make sure we don't request new info from server too fast
listDirty = 20;
String channelName = channelNameField.getText();
if (channelFromServer != null) {
channelFromServer.setName(channelName);
}
sendServerCommand(RFToolsMessages.INSTANCE, SecurityManagerTileEntity.CMD_SETCHANNELNAME, new Argument("name", channelName));
}
Aggregations