Search in sources :

Example 31 with Argument

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);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout)

Example 32 with Argument

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));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 33 with Argument

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()));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 34 with Argument

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));
}
Also used : Argument(mcjty.lib.network.Argument) BlockPos(net.minecraft.util.math.BlockPos)

Example 35 with Argument

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));
}
Also used : Argument(mcjty.lib.network.Argument)

Aggregations

Argument (mcjty.lib.network.Argument)97 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)8 Window (mcjty.lib.gui.Window)7 Panel (mcjty.lib.gui.widgets.Panel)6 ItemStack (net.minecraft.item.ItemStack)6 PacketServerCommand (mcjty.lib.network.PacketServerCommand)4 ArrayList (java.util.ArrayList)3 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)3 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)3 Label (mcjty.lib.gui.widgets.Label)3 PacketRequestIntegerFromServer (mcjty.lib.network.PacketRequestIntegerFromServer)3 java.awt (java.awt)2 Rectangle (java.awt.Rectangle)2 StyleConfig (mcjty.lib.base.StyleConfig)2 GenericEnergyStorageTileEntity (mcjty.lib.entity.GenericEnergyStorageTileEntity)2 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)2 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)2 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)2 ChoiceLabel (mcjty.lib.gui.widgets.ChoiceLabel)2 TextField (mcjty.lib.gui.widgets.TextField)2