Search in sources :

Example 66 with Window

use of mcjty.lib.gui.Window in project RFToolsControl by McJty.

the class GuiProcessor method openValueEditor.

private void openValueEditor(int varIdx) {
    if (fromServer_vars == null || varIdx > fromServer_vars.size()) {
        return;
    }
    if (fromServer_vars.get(varIdx) == null) {
        GuiTools.showMessage(mc, this, getWindowManager(), 50, 50, "Variable is not defined!");
        return;
    }
    Parameter parameter = fromServer_vars.get(varIdx);
    if (parameter == null) {
        GuiTools.showMessage(mc, this, getWindowManager(), 50, 50, "Variable is not defined!");
        return;
    }
    ParameterType type = parameter.getParameterType();
    ParameterEditor editor = ParameterEditors.getEditor(type);
    Panel editPanel;
    if (editor != null) {
        editPanel = new Panel(mc, this).setLayout(new PositionalLayout()).setFilledRectThickness(1);
        editor.build(mc, this, editPanel, o -> {
            NBTTagCompound tag = new NBTTagCompound();
            ParameterTypeTools.writeToNBT(tag, type, o);
            RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketVariableToServer(tileEntity.getPos(), varIdx, tag));
        });
        editor.writeValue(parameter.getParameterValue());
        editor.constantOnly();
    } else {
        return;
    }
    Panel panel = new Panel(mc, this).setLayout(new VerticalLayout()).setFilledBackground(0xff666666, 0xffaaaaaa).setFilledRectThickness(1);
    panel.setBounds(new Rectangle(50, 50, 200, 60 + editor.getHeight()));
    Window modalWindow = getWindowManager().createModalWindow(panel);
    panel.addChild(new Label(mc, this).setText("Var " + varIdx + ":"));
    panel.addChild(editPanel);
    panel.addChild(new Button(mc, this).addButtonEvent(w -> {
        getWindowManager().closeWindow(modalWindow);
    }).setText("Close"));
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ParameterType(mcjty.rftoolscontrol.api.parameters.ParameterType) Button(mcjty.lib.gui.widgets.Button) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Label(mcjty.lib.gui.widgets.Label) Parameter(mcjty.rftoolscontrol.api.parameters.Parameter) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) ParameterEditor(mcjty.rftoolscontrol.logic.editors.ParameterEditor)

Example 67 with Window

use of mcjty.lib.gui.Window in project RFToolsControl by McJty.

the class GuiCraftingCard method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(iconLocation);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    toplevel.addChild(new Label(mc, this).setText("Regular 3x3 crafting recipe").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 4, 160, 14)));
    toplevel.addChild(new Label(mc, this).setText("or more complicated recipes").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 17, 160, 14)));
    toplevel.addChild(new Button(mc, this).setText("Update").setTooltips("Update the item in the output", "slot to the recipe in the", "3x3 grid").addButtonEvent(parent -> RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketSendServerCommand(RFToolsControl.MODID, CommandHandler.CMD_TESTRECIPE, Arguments.EMPTY))).setLayoutHint(new PositionalLayout.PositionalHint(110, 57, 60, 14)));
    ToggleButton toggle = new ToggleButton(mc, this).setCheckMarker(true).setText("NBT").setTooltips("Enable this if you want", "opcodes like 'get_ingredients'", "to strictly match on NBT").setLayoutHint(new PositionalLayout.PositionalHint(110, 74, 60, 14));
    ItemStack heldItem = mc.player.getHeldItem(EnumHand.MAIN_HAND);
    if (!heldItem.isEmpty()) {
        toggle.setPressed(CraftingCardItem.isStrictNBT(heldItem));
    }
    toggle.addButtonEvent(parent -> {
        RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketUpdateNBTItemCard(new Argument("strictnbt", toggle.isPressed())));
    });
    toplevel.addChild(toggle);
    for (int y = 0; y < GRID_HEIGHT; y++) {
        for (int x = 0; x < GRID_WIDTH; x++) {
            int idx = y * GRID_WIDTH + x;
            createDummySlot(toplevel, idx, new PositionalLayout.PositionalHint(x * 18 + 10, y * 18 + 37, 18, 18), createSelectionEvent(idx));
        }
    }
    createDummySlot(toplevel, INPUT_SLOTS, new PositionalLayout.PositionalHint(10 + 8 * 18, 37, 18, 18), createSelectionEvent(INPUT_SLOTS));
    updateSlots();
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) PacketSendServerCommand(mcjty.lib.network.PacketSendServerCommand) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle) ItemStack(net.minecraft.item.ItemStack)

Example 68 with Window

use of mcjty.lib.gui.Window in project RFToolsControl by McJty.

the class GuiMultiTank method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(iconLocation);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    for (int i = 0; i < TANKS; i++) {
        liquids[i] = new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(10, 9 + i * 18, 16, 16));
        toplevel.addChild(liquids[i]);
        labels[i] = new Label(mc, this);
        labels[i].setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setVerticalAlignment(VerticalAlignment.ALIGN_CENTER).setLayoutHint(new PositionalLayout.PositionalHint(32, 9 + i * 18, WIDTH - 32 - 6, 16));
        toplevel.addChild(labels[i]);
    }
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) BlockRender(mcjty.lib.gui.widgets.BlockRender)

Example 69 with Window

use of mcjty.lib.gui.Window in project RFToolsControl by McJty.

the class GuiNode method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
    channelField = new TextField(mc, this).setTooltips("Set the name of the network", "channel to connect too").addTextEvent((parent, newText) -> updateNode());
    channelField.setText(tileEntity.getChannelName());
    nodeNameField = new TextField(mc, this).setTooltips("Set the name of this node").addTextEvent((parent, newText) -> updateNode());
    nodeNameField.setText(tileEntity.getNodeName());
    Panel bottomPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Channel:")).addChild(channelField).addChild(new Label(mc, this).setText("Node:")).addChild(nodeNameField);
    toplevel.addChild(bottomPanel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, WIDTH, HEIGHT));
    window = new Window(this, toplevel);
}
Also used : EmptyContainer(mcjty.lib.container.EmptyContainer) GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) Window(mcjty.lib.gui.Window) java.awt(java.awt) RFToolsCtrlMessages(mcjty.rftoolscontrol.network.RFToolsCtrlMessages) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) TextField(mcjty.lib.gui.widgets.TextField) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) RFToolsControl(mcjty.rftoolscontrol.RFToolsControl) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Label(mcjty.lib.gui.widgets.Label) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) TextField(mcjty.lib.gui.widgets.TextField) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 70 with Window

use of mcjty.lib.gui.Window in project RFToolsControl by McJty.

the class GuiWorkbench method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(mainBackground);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, WIDTH, HEIGHT));
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout)

Aggregations

Window (mcjty.lib.gui.Window)74 Panel (mcjty.lib.gui.widgets.Panel)57 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)48 Label (mcjty.lib.gui.widgets.Label)36 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)29 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)28 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)24 Argument (mcjty.lib.network.Argument)24 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)23 java.awt (java.awt)22 Button (mcjty.lib.gui.widgets.Button)22 RFTools (mcjty.rftools.RFTools)22 TextField (mcjty.lib.gui.widgets.TextField)21 Rectangle (java.awt.Rectangle)20 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)20 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)18 ResourceLocation (net.minecraft.util.ResourceLocation)17 StyleConfig (mcjty.lib.base.StyleConfig)15 List (java.util.List)12 EmptyContainer (mcjty.lib.container.EmptyContainer)11