Search in sources :

Example 86 with Argument

use of mcjty.lib.network.Argument in project RFTools by McJty.

the class GuiShield method changeRedstoneMode.

private void changeRedstoneMode() {
    tileEntity.setRSMode(RedstoneMode.values()[redstoneMode.getCurrentChoiceIndex()]);
    sendServerCommand(RFToolsMessages.INSTANCE, ShieldTEBase.CMD_RSMODE, new Argument("rs", RedstoneMode.values()[redstoneMode.getCurrentChoiceIndex()].getDescription()));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 87 with Argument

use of mcjty.lib.network.Argument in project RFTools by McJty.

the class GuiShield method addNewFilter.

private void addNewFilter() {
    String actionName = actionOptions.getCurrentChoice();
    int action;
    if (ACTION_PASS.equals(actionName)) {
        action = ShieldFilter.ACTION_PASS;
    } else if (ACTION_SOLID.equals(actionName)) {
        action = ShieldFilter.ACTION_SOLID;
    } else if (ACTION_SOLIDDAMAGE.equals(actionName)) {
        action = ShieldFilter.ACTION_DAMAGE + ShieldFilter.ACTION_SOLID;
    } else {
        action = ShieldFilter.ACTION_DAMAGE;
    }
    String filterName = typeOptions.getCurrentChoice();
    String type;
    if ("All".equals(filterName)) {
        type = DefaultFilter.DEFAULT;
    } else if ("Passive".equals(filterName)) {
        type = AnimalFilter.ANIMAL;
    } else if ("Hostile".equals(filterName)) {
        type = HostileFilter.HOSTILE;
    } else if ("Item".equals(filterName)) {
        type = ItemFilter.ITEM;
    } else {
        type = PlayerFilter.PLAYER;
    }
    String playerName = player.getText();
    int selected = filterList.getSelected();
    sendServerCommand(RFToolsMessages.INSTANCE, ShieldTEBase.CMD_ADDFILTER, new Argument("action", action), new Argument("type", type), new Argument("player", playerName), new Argument("selected", selected));
    listDirty = 0;
}
Also used : Argument(mcjty.lib.network.Argument)

Example 88 with Argument

use of mcjty.lib.network.Argument in project RFTools by McJty.

the class GuiShield method changeVisibilityMode.

private void changeVisibilityMode() {
    ShieldRenderingMode newMode = ShieldRenderingMode.getMode(visibilityOptions.getCurrentChoice());
    tileEntity.setShieldRenderingMode(newMode);
    sendServerCommand(RFToolsMessages.INSTANCE, ShieldTEBase.CMD_SHIELDVISMODE, new Argument("mode", newMode.getDescription()));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 89 with Argument

use of mcjty.lib.network.Argument in project RFTools by McJty.

the class GuiSecurityManager method updateSettings.

private void updateSettings() {
    // Make sure we don't request new info from server too fast
    listDirty = 20;
    boolean whitelist = blacklistMode.getCurrentChoiceIndex() == 0;
    if (channelFromServer != null) {
        channelFromServer.setWhitelist(whitelist);
    }
    sendServerCommand(RFToolsMessages.INSTANCE, SecurityManagerTileEntity.CMD_SETMODE, new Argument("whitelist", whitelist));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 90 with Argument

use of mcjty.lib.network.Argument in project XNet by McJty.

the class GuiConnector method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
    nameField = new TextField(mc, this).setTooltips("Set the name of this connector").addTextEvent((parent, newText) -> updateName());
    nameField.setText(tileEntity.getConnectorName());
    Panel namePanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Name:")).addChild(nameField);
    toplevel.addChild(namePanel);
    Panel togglePanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Directions:"));
    for (EnumFacing facing : EnumFacing.VALUES) {
        toggleButtons[facing.ordinal()] = new ToggleButton(mc, this).setText(facing.getName().substring(0, 1).toUpperCase()).addButtonEvent(parent -> {
            sendServerCommand(XNetMessages.INSTANCE, ConnectorTileEntity.CMD_ENABLE, new Argument("facing", facing.ordinal()), new Argument("enabled", toggleButtons[facing.ordinal()].isPressed()));
        });
        toggleButtons[facing.ordinal()].setPressed(tileEntity.isEnabled(facing));
        togglePanel.addChild(toggleButtons[facing.ordinal()]);
    }
    toplevel.addChild(togglePanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, WIDTH, HEIGHT));
    window = new Window(this, toplevel);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) TextField(mcjty.lib.gui.widgets.TextField) EnumFacing(net.minecraft.util.EnumFacing) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) EmptyContainer(mcjty.lib.container.EmptyContainer) Window(mcjty.lib.gui.Window) XNet(mcjty.xnet.XNet) java.awt(java.awt) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Argument(mcjty.lib.network.Argument) GuiProxy(mcjty.xnet.gui.GuiProxy) Panel(mcjty.lib.gui.widgets.Panel) XNetMessages(mcjty.xnet.network.XNetMessages) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) Argument(mcjty.lib.network.Argument) EnumFacing(net.minecraft.util.EnumFacing) Label(mcjty.lib.gui.widgets.Label) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) TextField(mcjty.lib.gui.widgets.TextField) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

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