Search in sources :

Example 26 with Argument

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

the class GuiSensor method setGroup.

private void setGroup() {
    GroupType groupType = NamedEnum.getEnumByName(groupLabel.getCurrentChoice(), GroupType.values());
    tileEntity.setGroupType(groupType);
    sendServerCommand(RFToolsMessages.INSTANCE, SensorTileEntity.CMD_SETGROUP, new Argument("type", groupType.ordinal()));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 27 with Argument

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

the class GuiSequencer method changeBit.

private void changeBit(int bit, String choice) {
    boolean newChoice = "1".equals(choice);
    tileEntity.setCycleBit(bit, newChoice);
    sendServerCommand(RFToolsMessages.INSTANCE, SequencerTileEntity.CMD_SETBIT, new Argument("bit", bit), new Argument("choice", newChoice));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 28 with Argument

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

the class GuiSequencer method setEndState.

private void setEndState(String choice) {
    boolean newChoice = "1".equals(choice);
    tileEntity.setEndState(newChoice);
    sendServerCommand(RFToolsMessages.INSTANCE, SequencerTileEntity.CMD_SETENDSTATE, new Argument("endState", newChoice));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 29 with Argument

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

the class ScreenTileEntity method hitScreenClient.

public void hitScreenClient(double hitX, double hitY, double hitZ, EnumFacing side, EnumFacing horizontalFacing) {
    ModuleRaytraceResult result = getHitModule(hitX, hitY, hitZ, side, horizontalFacing);
    if (result == null) {
        return;
    }
    List<IClientScreenModule> modules = getClientScreenModules();
    int module = result.getModuleIndex();
    if (isActivated(module)) {
        // We are getting a hit twice. Module is already activated. Do nothing
        return;
    }
    modules.get(module).mouseClick(getWorld(), result.getX(), result.getY() - result.getCurrenty(), true);
    clickedModules.add(new ActivatedModule(module, 3, result.getX(), result.getY()));
    RFToolsMessages.INSTANCE.sendToServer(new PacketServerCommand(getPos(), CMD_CLICK, new Argument("x", result.getX()), new Argument("y", result.getY() - result.getCurrenty()), new Argument("module", module)));
}
Also used : Argument(mcjty.lib.network.Argument) PacketServerCommand(mcjty.lib.network.PacketServerCommand)

Example 30 with Argument

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

the class GuiScreen method initGui.

@Override
public void initGui() {
    super.initGui();
    toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    for (int i = 0; i < ScreenContainer.SCREEN_MODULES; i++) {
        buttons[i] = new ToggleButton(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(30, 7 + i * 18 + 1, 40, 16)).setEnabled(false).setTooltips("Open the gui for this", "module");
        final int finalI = i;
        buttons[i].addButtonEvent(parent -> selectPanel(finalI));
        toplevel.addChild(buttons[i]);
        modulePanels[i] = null;
        clientScreenModules[i] = null;
    }
    bright = new ToggleButton(mc, this).setText("Bright").setCheckMarker(true).setTooltips("Toggle full brightness").setLayoutHint(new PositionalLayout.PositionalHint(85, 123, 55, 14));
    // .setLayoutHint(new PositionalLayout.PositionalHint(7, 208, 63, 14));
    bright.setPressed(tileEntity.isBright());
    bright.addButtonEvent(parent -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenTileEntity.CMD_SETBRIGHT, new Argument("b", bright.isPressed())));
    toplevel.addChild(bright);
    toplevel.addChild(new Label(mc, this).setText("Font:").setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setLayoutHint(new PositionalLayout.PositionalHint(85 + 50 + 9, 123, 30, 14)));
    trueType = new ChoiceLabel(mc, this).addChoices("Default", "Truetype", "Vanilla").setTooltips("Set truetype font mode", "for the screen").setLayoutHint(new PositionalLayout.PositionalHint(85 + 50 + 14 + 30, 123, 68, 14));
    int trueTypeMode = tileEntity.getTrueTypeMode();
    trueType.setChoice(trueTypeMode == 0 ? "Default" : (trueTypeMode == -1 ? "Vanilla" : "Truetype"));
    trueType.addChoiceEvent((a, b) -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenTileEntity.CMD_SETTRUETYPE, new Argument("b", getCurrentTruetypeChoice())));
    toplevel.addChild(trueType);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    Keyboard.enableRepeatEvents(true);
    selected = -1;
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) Argument(mcjty.lib.network.Argument) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel)

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