Search in sources :

Example 1 with Gui

use of net.minecraft.client.gui.Gui in project RFToolsControl by McJty.

the class NumberEditor method build.

@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
    Panel constantPanel = new Panel(mc, gui).setLayout(new VerticalLayout());
    typeLabel = new ChoiceLabel(mc, gui).addChoices("Integer", "Long", "Float", "Double").addChoiceEvent((parent, newChoice) -> callback.valueChanged(readValue())).setDesiredWidth(60);
    constantPanel.addChild(createLabeledPanel(mc, gui, "Type:", typeLabel, "Type of the number"));
    field = new TextField(mc, gui).addTextEvent((parent, newText) -> callback.valueChanged(readValue())).addTextEnterEvent((parent, newText) -> closeWindow());
    constantPanel.addChild(field);
    createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_NUMBER);
}
Also used : Window(mcjty.lib.gui.Window) ParameterType(mcjty.rftoolscontrol.api.parameters.ParameterType) TextField(mcjty.lib.gui.widgets.TextField) Gui(net.minecraft.client.gui.Gui) Panel(mcjty.lib.gui.widgets.Panel) ParameterValue(mcjty.rftoolscontrol.api.parameters.ParameterValue) Minecraft(net.minecraft.client.Minecraft) TypeConverters(mcjty.rftoolscontrol.logic.TypeConverters) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) TextField(mcjty.lib.gui.widgets.TextField)

Example 2 with Gui

use of net.minecraft.client.gui.Gui in project RFToolsControl by McJty.

the class StringEditor method build.

@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
    Panel constantPanel = new Panel(mc, gui).setLayout(new HorizontalLayout());
    field = new TextField(mc, gui).addTextEvent((parent, newText) -> callback.valueChanged(readValue())).addTextEnterEvent((parent, newText) -> closeWindow());
    constantPanel.addChild(field);
    createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_STRING);
}
Also used : Window(mcjty.lib.gui.Window) ParameterType(mcjty.rftoolscontrol.api.parameters.ParameterType) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) TextField(mcjty.lib.gui.widgets.TextField) Gui(net.minecraft.client.gui.Gui) Panel(mcjty.lib.gui.widgets.Panel) ParameterValue(mcjty.rftoolscontrol.api.parameters.ParameterValue) Minecraft(net.minecraft.client.Minecraft) Panel(mcjty.lib.gui.widgets.Panel) TextField(mcjty.lib.gui.widgets.TextField) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 3 with Gui

use of net.minecraft.client.gui.Gui in project RFToolsControl by McJty.

the class AbstractParameterEditor method createEditorPanel.

void createEditorPanel(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback, Panel constantPanel, ParameterType type) {
    Panel variablePanel = new Panel(mc, gui).setLayout(new HorizontalLayout()).setDesiredHeight(18);
    variableIndex = new TextField(mc, gui).setDesiredHeight(14).setTooltips("Index (in the processor)", "of the variable", "(first variable has index 0)").addTextEvent((parent, newText) -> callback.valueChanged(readValue()));
    variablePanel.addChild(new Label(mc, gui).setText("Index:")).setTooltips("Index (in the processor)", "of the variable", "(first variable has index 0)").setDesiredHeight(14).addChild(variableIndex);
    Panel functionPanel = new Panel(mc, gui).setLayout(new HorizontalLayout());
    functionLabel = new ChoiceLabel(mc, gui).setDesiredWidth(120);
    List<Function> functions = Functions.getFunctionsByType(type);
    for (Function function : functions) {
        functionLabel.addChoices(function.getId());
        functionLabel.setChoiceTooltip(function.getId(), function.getDescription().toArray(new String[function.getDescription().size()]));
    }
    functionPanel.addChild(functionLabel);
    functionLabel.addChoiceEvent(((parent, newChoice) -> callback.valueChanged(readValue())));
    tabbedPanel = new TabbedPanel(mc, gui).addPage(PAGE_CONSTANT, constantPanel).addPage(PAGE_VARIABLE, variablePanel).addPage(PAGE_FUNCTION, functionPanel);
    tabbedPanel.setLayoutHint(new PositionalLayout.PositionalHint(5, 5 + 18, 190 - 10, 60 + getHeight() - 5 - 18 - 40));
    buttonPanel = new Panel(mc, gui).setLayout(new HorizontalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(5, 5, 190 - 10, 18));
    ToggleButton constantButton = new ToggleButton(mc, gui).setText(PAGE_CONSTANT).addButtonEvent(w -> switchPage(PAGE_CONSTANT, callback));
    variableButton = new ToggleButton(mc, gui).setText(PAGE_VARIABLE).addButtonEvent(w -> switchPage(PAGE_VARIABLE, callback));
    functionButton = new ToggleButton(mc, gui).setText(PAGE_FUNCTION).addButtonEvent(w -> switchPage(PAGE_FUNCTION, callback));
    buttonPanel.addChild(constantButton).addChild(variableButton).addChild(functionButton);
    panel.addChild(buttonPanel).addChild(tabbedPanel);
}
Also used : Window(mcjty.lib.gui.Window) ParameterType(mcjty.rftoolscontrol.api.parameters.ParameterType) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Gui(net.minecraft.client.gui.Gui) List(java.util.List) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) ParameterValue(mcjty.rftoolscontrol.api.parameters.ParameterValue) Minecraft(net.minecraft.client.Minecraft) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Function(mcjty.rftoolscontrol.api.code.Function) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Functions(mcjty.rftoolscontrol.logic.registry.Functions) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Function(mcjty.rftoolscontrol.api.code.Function)

Example 4 with Gui

use of net.minecraft.client.gui.Gui in project RFToolsControl by McJty.

the class IntegerEditor method build.

@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
    Panel constantPanel = new Panel(mc, gui).setLayout(new HorizontalLayout());
    field = new TextField(mc, gui).addTextEvent((parent, newText) -> callback.valueChanged(readValue())).addTextEnterEvent((parent, newText) -> closeWindow());
    constantPanel.addChild(field);
    hexMode = new ToggleButton(mc, gui).addButtonEvent(widget -> updateHex()).setCheckMarker(true).setText("Hex");
    constantPanel.addChild(hexMode);
    createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_INTEGER);
}
Also used : Window(mcjty.lib.gui.Window) ParameterType(mcjty.rftoolscontrol.api.parameters.ParameterType) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) TextField(mcjty.lib.gui.widgets.TextField) Gui(net.minecraft.client.gui.Gui) Panel(mcjty.lib.gui.widgets.Panel) ParameterValue(mcjty.rftoolscontrol.api.parameters.ParameterValue) Minecraft(net.minecraft.client.Minecraft) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) TextField(mcjty.lib.gui.widgets.TextField) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 5 with Gui

use of net.minecraft.client.gui.Gui in project RFToolsControl by McJty.

the class InventoryEditor method build.

@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
    Panel constantPanel = new Panel(mc, gui).setLayout(new VerticalLayout());
    nameLabel = new TextField(mc, gui).addTextEvent((o, text) -> callback.valueChanged(readValue())).addTextEnterEvent((parent, newText) -> closeWindow()).setDesiredWidth(50).setDesiredHeight(14);
    constantPanel.addChild(createLabeledPanel(mc, gui, "Node name:", nameLabel, "Optional name of a node in the network"));
    sideLabel = new ChoiceLabel(mc, gui).addChoices("*", "Down", "Up", "North", "South", "West", "East").addChoiceEvent((parent, newChoice) -> callback.valueChanged(readValue())).setDesiredWidth(60);
    constantPanel.addChild(createLabeledPanel(mc, gui, "Side:", sideLabel, "Side relative to processor or node", "for the desired inventory"));
    intSideLabel = new ChoiceLabel(mc, gui).addChoices("*", "Down", "Up", "North", "South", "West", "East").addChoiceEvent((parent, newChoice) -> callback.valueChanged(readValue())).setDesiredWidth(60);
    constantPanel.addChild(createLabeledPanel(mc, gui, "Access:", intSideLabel, "Optional side from which we want to", "access the given inventory"));
    createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_INVENTORY);
}
Also used : Window(mcjty.lib.gui.Window) ParameterType(mcjty.rftoolscontrol.api.parameters.ParameterType) TextField(mcjty.lib.gui.widgets.TextField) Gui(net.minecraft.client.gui.Gui) Panel(mcjty.lib.gui.widgets.Panel) ParameterValue(mcjty.rftoolscontrol.api.parameters.ParameterValue) Minecraft(net.minecraft.client.Minecraft) EnumFacing(net.minecraft.util.EnumFacing) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) StringUtils(org.apache.commons.lang3.StringUtils) Inventory(mcjty.rftoolscontrol.api.parameters.Inventory) Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) TextField(mcjty.lib.gui.widgets.TextField)

Aggregations

Gui (net.minecraft.client.gui.Gui)19 Minecraft (net.minecraft.client.Minecraft)12 Window (mcjty.lib.gui.Window)11 Panel (mcjty.lib.gui.widgets.Panel)9 TextField (mcjty.lib.gui.widgets.TextField)9 ParameterType (mcjty.rftoolscontrol.api.parameters.ParameterType)9 ParameterValue (mcjty.rftoolscontrol.api.parameters.ParameterValue)9 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)7 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)5 ChoiceLabel (mcjty.lib.gui.widgets.ChoiceLabel)3 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)2 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)2 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)2 ToggleButton (mcjty.lib.gui.widgets.ToggleButton)2 GuiTextField (net.minecraft.client.gui.GuiTextField)2 ItemStack (net.minecraft.item.ItemStack)2 EnumFacing (net.minecraft.util.EnumFacing)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 java.awt (java.awt)1 Rectangle (java.awt.Rectangle)1