Search in sources :

Example 81 with Argument

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

the class GuiEnvironmentalController method addPlayer.

private void addPlayer() {
    sendServerCommand(RFToolsMessages.INSTANCE, EnvironmentalControllerTileEntity.CMD_ADDPLAYER, new Argument("player", nameField.getText()));
    listDirty = 0;
}
Also used : Argument(mcjty.lib.network.Argument)

Example 82 with Argument

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

the class GuiLocator method update.

private void update() {
    List<Argument> arguments = new ArrayList<>();
    arguments.add(new Argument("hostile", COLOR_TO_TYPE.get(hostile.getCurrentColor()).getCode()));
    arguments.add(new Argument("passive", COLOR_TO_TYPE.get(passive.getCurrentColor()).getCode()));
    arguments.add(new Argument("player", COLOR_TO_TYPE.get(player.getCurrentColor()).getCode()));
    arguments.add(new Argument("energy", COLOR_TO_TYPE.get(energy.getCurrentColor()).getCode()));
    arguments.add(new Argument("hostileBeacon", hostileBeacon.isPressed()));
    arguments.add(new Argument("passiveBeacon", passiveBeacon.isPressed()));
    arguments.add(new Argument("playerBeacon", playerBeacon.isPressed()));
    arguments.add(new Argument("energyBeacon", energyBeacon.isPressed()));
    arguments.add(new Argument("filter", filter.getText()));
    if (!minEnergy.getText().trim().isEmpty()) {
        try {
            arguments.add(new Argument("minEnergy", Integer.parseInt(minEnergy.getText())));
        } catch (NumberFormatException e) {
        }
    }
    if (!maxEnergy.getText().trim().isEmpty()) {
        try {
            arguments.add(new Argument("maxEnergy", Integer.parseInt(maxEnergy.getText())));
        } catch (NumberFormatException e) {
        }
    }
    sendServerCommand(RFToolsMessages.INSTANCE, LocatorTileEntity.CMD_SETTINGS, arguments.toArray(new Argument[arguments.size()]));
}
Also used : Argument(mcjty.lib.network.Argument) ArrayList(java.util.ArrayList)

Example 83 with Argument

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

the class GuiLocator method changeRedstoneMode.

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

Example 84 with Argument

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

the class GuiProjector method updateRs.

private void updateRs() {
    List<Argument> argumentList = new ArrayList<>();
    for (int i = 0; i < 4; i++) {
        argumentList.add(new Argument("opOn" + i, rsLabelOn[i].getCurrentChoice()));
        argumentList.add(new Argument("opOff" + i, rsLabelOff[i].getCurrentChoice()));
        String text = valOn[i].getText();
        if (!text.trim().isEmpty()) {
            try {
                argumentList.add(new Argument("valOn" + i, Double.parseDouble(text)));
            } catch (NumberFormatException e) {
            // Ignore
            }
        }
        text = valOff[i].getText();
        if (!text.trim().isEmpty()) {
            try {
                argumentList.add(new Argument("valOff" + i, Double.parseDouble(text)));
            } catch (NumberFormatException e) {
            // Ignore
            }
        }
    }
    sendServerCommand(RFToolsMessages.INSTANCE, ProjectorTileEntity.CMD_RSSETTINGS, argumentList.toArray(new Argument[argumentList.size()]));
}
Also used : Argument(mcjty.lib.network.Argument) ArrayList(java.util.ArrayList)

Example 85 with Argument

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

the class GuiShield method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(12, 141, 10, 76)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    initVisibilityMode();
    initActionOptions();
    initTypeOptions();
    initRedstoneMode();
    initDamageType();
    filterList = new WidgetList(mc, this).setDesiredHeight(120).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            selectFilter();
        }
    });
    Slider filterSlider = new Slider(mc, this).setVertical().setScrollable(filterList).setDesiredWidth(11).setDesiredHeight(120);
    Panel filterPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).setLayoutHint(new PositionalLayout.PositionalHint(12, 10, 154, 124)).addChild(filterList).addChild(filterSlider).setFilledBackground(0xff9e9e9e);
    Button applyCamo = new Button(mc, this).setText("Set").setTooltips("Set the camouflage block").setLayoutHint(new PositionalLayout.PositionalHint(51, 142, 28, 16)).addButtonEvent(parent -> applyCamoToShield());
    // applyCamo.setEnabled(false);
    // applyCamo.setTooltips("Not implemented yet");   // @todo
    colorSelector = new ColorChoiceLabel(mc, this).setTooltips("Color for the shield").setLayoutHint(new PositionalLayout.PositionalHint(31, 177, 48, 16));
    colorSelector.addColors(0x96ffc8);
    for (EnumDyeColor color : EnumDyeColor.values()) {
        colorSelector.addColors(color.getColorValue());
    }
    colorSelector.setCurrentColor(tileEntity.getShieldColor());
    colorSelector.addChoiceEvent((parent, newColor) -> sendServerCommand(RFToolsMessages.INSTANCE, ShieldTEBase.CMD_SETCOLOR, new Argument("color", newColor)));
    player = new TextField(mc, this).setTooltips("Optional player name").setLayoutHint(new PositionalLayout.PositionalHint(170, 44, 80, 14));
    addFilter = new Button(mc, this).setText("Add").setTooltips("Add selected filter").setLayoutHint(new PositionalLayout.PositionalHint(4, 6, 36, 14)).addButtonEvent(parent -> addNewFilter());
    delFilter = new Button(mc, this).setText("Del").setTooltips("Delete selected filter").setLayoutHint(new PositionalLayout.PositionalHint(39, 6, 36, 14)).addButtonEvent(parent -> removeSelectedFilter());
    upFilter = new Button(mc, this).setText("Up").setTooltips("Move filter up").setLayoutHint(new PositionalLayout.PositionalHint(4, 22, 36, 14)).addButtonEvent(parent -> moveFilterUp());
    downFilter = new Button(mc, this).setText("Down").setTooltips("Move filter down").setLayoutHint(new PositionalLayout.PositionalHint(39, 22, 36, 14)).addButtonEvent(parent -> moveFilterDown());
    Panel controlPanel = new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(170, 58, 80, 43)).addChild(addFilter).addChild(delFilter).addChild(upFilter).addChild(downFilter).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
    Label lootingBonus = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setText("Looting:");
    lootingBonus.setTooltips("Insert dimensional shards", "for looting bonus").setLayoutHint(new PositionalLayout.PositionalHint(160, 118, 60, 18));
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(visibilityOptions).addChild(applyCamo).addChild(redstoneMode).addChild(filterPanel).addChild(actionOptions).addChild(typeOptions).addChild(player).addChild(controlPanel).addChild(damageType).addChild(colorSelector).addChild(lootingBonus);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    listDirty = 0;
    requestFilters();
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Label(mcjty.lib.gui.widgets.Label) ArrayList(java.util.ArrayList) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) ItemStack(net.minecraft.item.ItemStack) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) mcjty.rftools.blocks.shield.filters(mcjty.rftools.blocks.shield.filters) Panel(mcjty.lib.gui.widgets.Panel) Block(net.minecraft.block.Block) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) RFTools(mcjty.rftools.RFTools) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) RedstoneMode(mcjty.lib.varia.RedstoneMode) java.awt(java.awt) Argument(mcjty.lib.network.Argument) List(java.util.List) EnumDyeColor(net.minecraft.item.EnumDyeColor) Button(mcjty.lib.gui.widgets.Button) ResourceLocation(net.minecraft.util.ResourceLocation) Window(mcjty.lib.gui.Window) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) EnumDyeColor(net.minecraft.item.EnumDyeColor) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) TextField(mcjty.lib.gui.widgets.TextField) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

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