Search in sources :

Example 1 with Argument

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

the class GuiDimletWorkbench method cheatDimlet.

private void cheatDimlet() {
    int selected = itemList.getSelected();
    if (selected == -1) {
        return;
    }
    Widget widget = itemList.getChild(selected);
    Object userObject = widget.getUserObject();
    if (userObject instanceof DimletKey) {
        DimletKey key = (DimletKey) userObject;
        sendServerCommand(RFToolsDimMessages.INSTANCE, DimletWorkbenchTileEntity.CMD_CHEATDIMLET, new Argument("type", key.getType().dimletType.getName()), new Argument("id", key.getId()));
    }
}
Also used : Argument(mcjty.lib.network.Argument) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey)

Example 2 with Argument

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

the class GuiDimletWorkbench method setExtractMode.

private void setExtractMode() {
    tileEntity.setExtractMode(extractButton.isPressed());
    sendServerCommand(RFToolsDimMessages.INSTANCE, DimletWorkbenchTileEntity.CMD_EXTRACTMODE, new Argument("mode", extractButton.isPressed()));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 3 with Argument

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

the class GuiEnvironmentalController method initAreaPanel.

private Panel initAreaPanel() {
    int r = tileEntity.getRadius();
    if (r < 5) {
        r = 5;
    } else if (r > 100) {
        r = 100;
    }
    int miny = tileEntity.getMiny();
    int maxy = tileEntity.getMaxy();
    Panel areaPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(28, 6, ENV_WIDTH - 33, 37)).setLayout(new VerticalLayout().setVerticalMargin(2).setSpacing(0)).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
    Panel radiusPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(16);
    ScrollableLabel radius = new ScrollableLabel(mc, this).setRealMinimum(5).setRealMaximum(100).setRealValue(r).setDesiredWidth(24).addValueEvent((parent, newValue) -> sendServerCommand(RFToolsMessages.INSTANCE, EnvironmentalControllerTileEntity.CMD_SETRADIUS, new Argument("radius", newValue)));
    Slider slider = new Slider(mc, this).setHorizontal().setScrollable(radius).setMinimumKnobSize(12);
    radiusPanel.addChild(new Label(mc, this).setText("Radius:")).addChild(slider).addChild(radius);
    Panel minPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(17);
    minyTextField = new TextField(mc, this).setText(Integer.toString(miny)).addTextEvent((parent, newText) -> sendBounds(true));
    maxyTextField = new TextField(mc, this).setText(Integer.toString(maxy)).addTextEvent((parent, newText) -> sendBounds(false));
    minPanel.addChild(new Label(mc, this).setText("Height:")).addChild(minyTextField).addChild(maxyTextField);
    areaPanel.addChild(radiusPanel).addChild(minPanel);
    return areaPanel;
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) java.util(java.util) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) PacketGetPlayers(mcjty.rftools.network.PacketGetPlayers) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) RedstoneMode(mcjty.lib.varia.RedstoneMode) Keyboard(org.lwjgl.input.Keyboard) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) RFTools(mcjty.rftools.RFTools) Argument(mcjty.lib.network.Argument) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 4 with Argument

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

the class GuiEnvironmentalController method sendBounds.

private void sendBounds(boolean minchanged) {
    int miny;
    int maxy;
    try {
        miny = Integer.parseInt(minyTextField.getText());
    } catch (NumberFormatException e) {
        miny = 0;
    }
    try {
        maxy = Integer.parseInt(maxyTextField.getText());
    } catch (NumberFormatException e) {
        maxy = 0;
    }
    if (minchanged) {
        if (miny > maxy) {
            maxy = miny;
            maxyTextField.setText(Integer.toString(maxy));
        }
    } else {
        if (miny > maxy) {
            miny = maxy;
            minyTextField.setText(Integer.toString(miny));
        }
    }
    sendServerCommand(RFToolsMessages.INSTANCE, EnvironmentalControllerTileEntity.CMD_SETBOUNDS, new Argument("miny", miny), new Argument("maxy", maxy));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 5 with Argument

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

the class GuiEnvironmentalController method changeMode.

private void changeMode(String newAccess) {
    EnvironmentalControllerTileEntity.EnvironmentalMode newmode;
    if (MODE_ALL.equals(newAccess)) {
        newmode = EnvironmentalControllerTileEntity.EnvironmentalMode.MODE_ALL;
    } else if (MODE_BLACKLIST.equals(newAccess)) {
        newmode = EnvironmentalControllerTileEntity.EnvironmentalMode.MODE_BLACKLIST;
    } else if (MODE_WHITELIST.equals(newAccess)) {
        newmode = EnvironmentalControllerTileEntity.EnvironmentalMode.MODE_WHITELIST;
    } else if (MODE_MOBS.equals(newAccess)) {
        newmode = EnvironmentalControllerTileEntity.EnvironmentalMode.MODE_MOBS;
    } else if (MODE_PASSIVE.equals(newAccess)) {
        newmode = EnvironmentalControllerTileEntity.EnvironmentalMode.MODE_PASSIVE;
    } else {
        newmode = EnvironmentalControllerTileEntity.EnvironmentalMode.MODE_HOSTILE;
    }
    sendServerCommand(RFToolsMessages.INSTANCE, EnvironmentalControllerTileEntity.CMD_SETMODE, new Argument("mode", newmode.ordinal()));
}
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