Search in sources :

Example 1 with WidgetComboBox

use of pneumaticCraft.client.gui.widget.WidgetComboBox in project PneumaticCraft by MineMaarten.

the class GuiRemoteEditor method initGui.

@Override
public void initGui() {
    if (pastebinGui != null && pastebinGui.outputTag != null) {
        NBTTagCompound tag = remote.getTagCompound();
        if (tag == null) {
            tag = new NBTTagCompound();
            remote.setTagCompound(tag);
        }
        tag.setTag("actionWidgets", pastebinGui.outputTag.getTagList("main", 10));
    } else if (remoteLayout != null) {
        NBTTagCompound tag = remote.getTagCompound();
        if (tag == null) {
            tag = new NBTTagCompound();
            remote.setTagCompound(tag);
        }
        tag.setTag("actionWidgets", remoteLayout.toNBT(oldGuiLeft, oldGuiTop).getTagList("actionWidgets", 10));
    }
    if (invSearchGui != null && invSearchGui.getSearchStack() != null && invSearchGui.getSearchStack().getItem() == Itemss.remote) {
        if (ItemRemote.hasSameSecuritySettings(remote, invSearchGui.getSearchStack())) {
            remoteLayout = new RemoteLayout(invSearchGui.getSearchStack(), guiLeft, guiTop);
        } else {
            mc.thePlayer.addChatComponentMessage(new ChatComponentTranslation("gui.remote.differentSecuritySettings"));
        }
    }
    super.initGui();
    oldGuiLeft = guiLeft;
    oldGuiTop = guiTop;
    visibleSpawnWidgets.clear();
    visibleSpawnWidgets.add(new ActionWidgetCheckBox(new GuiCheckBox(-1, guiLeft + 200, guiTop + 10, 0xFF000000, I18n.format("remote.checkbox.name"))));
    visibleSpawnWidgets.add(new ActionWidgetLabel(new WidgetLabelVariable(guiLeft + 200, guiTop + 25, I18n.format("remote.label.name"))));
    visibleSpawnWidgets.add(new ActionWidgetButton(new GuiButtonSpecial(-1, guiLeft + 200, guiTop + 40, 50, 20, I18n.format("remote.button.name"))));
    visibleSpawnWidgets.add(new ActionWidgetDropdown(new WidgetComboBox(fontRendererObj, guiLeft + 200, guiTop + 70, 70, fontRendererObj.FONT_HEIGHT + 1).setFixedOptions()));
    for (ActionWidget actionWidget : visibleSpawnWidgets) {
        addWidget(actionWidget.getWidget());
    }
    GuiButtonSpecial importRemoteButton = new GuiButtonSpecial(0, guiLeft - 24, guiTop + 20, 20, 20, "");
    importRemoteButton.setTooltipText(I18n.format("gui.remote.button.importRemoteButton"));
    importRemoteButton.setRenderStacks(new ItemStack(Itemss.remote));
    buttonList.add(importRemoteButton);
    GuiButtonSpecial pastebinButton = new GuiButtonSpecial(1, guiLeft - 24, guiTop + 44, 20, 20, "");
    pastebinButton.setTooltipText(I18n.format("gui.remote.button.pastebinButton"));
    //pastebinButton.setRenderStacks(new ItemStack(Itemss.advancedPCB));
    pastebinButton.setRenderedIcon(Textures.GUI_PASTEBIN_ICON_LOCATION);
    buttonList.add(pastebinButton);
}
Also used : PacketUpdateRemoteLayout(pneumaticCraft.common.network.PacketUpdateRemoteLayout) RemoteLayout(pneumaticCraft.common.remote.RemoteLayout) ActionWidgetCheckBox(pneumaticCraft.common.remote.ActionWidgetCheckBox) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ActionWidgetDropdown(pneumaticCraft.common.remote.ActionWidgetDropdown) ActionWidgetButton(pneumaticCraft.common.remote.ActionWidgetButton) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) ActionWidgetLabel(pneumaticCraft.common.remote.ActionWidgetLabel) GuiCheckBox(pneumaticCraft.client.gui.widget.GuiCheckBox) ActionWidget(pneumaticCraft.common.remote.ActionWidget) ItemStack(net.minecraft.item.ItemStack) WidgetLabelVariable(pneumaticCraft.common.remote.WidgetLabelVariable) WidgetComboBox(pneumaticCraft.client.gui.widget.WidgetComboBox)

Example 2 with WidgetComboBox

use of pneumaticCraft.client.gui.widget.WidgetComboBox in project PneumaticCraft by MineMaarten.

the class GuiProgWidgetCoordinate method initGui.

@Override
public void initGui() {
    super.initGui();
    if (invSearchGui != null) {
        ChunkPosition pos = invSearchGui.getSearchStack() != null ? ItemGPSTool.getGPSLocation(invSearchGui.getSearchStack()) : null;
        widget.setCoordinate(pos);
    }
    List<GuiRadioButton> radioButtons = new ArrayList<GuiRadioButton>();
    GuiRadioButton radioButton = new GuiRadioButton(0, guiLeft + 7, guiTop + 51, 0xFF000000, I18n.format("gui.progWidget.coordinate.constant"));
    if (!widget.isUsingVariable())
        radioButton.checked = true;
    radioButtons.add(radioButton);
    radioButton.otherChoices = radioButtons;
    addWidget(radioButton);
    radioButton = new GuiRadioButton(1, guiLeft + 7, guiTop + 100, 0xFF000000, I18n.format("gui.progWidget.coordinate.variable"));
    if (widget.isUsingVariable())
        radioButton.checked = true;
    radioButtons.add(radioButton);
    radioButton.otherChoices = radioButtons;
    addWidget(radioButton);
    gpsButton = new GuiButtonSpecial(0, guiLeft + 100, guiTop + 20, 20, 20, "");
    gpsButton.setRenderStacks(new ItemStack[] { new ItemStack(Itemss.GPSTool) });
    gpsButton.setTooltipText(I18n.format("gui.progWidget.coordinate.selectFromGPS"));
    gpsButton.enabled = !widget.isUsingVariable();
    buttonList.add(gpsButton);
    coordFields = new WidgetTextFieldNumber[3];
    for (int i = 0; i < 3; i++) {
        coordFields[i] = new WidgetTextFieldNumber(fontRendererObj, guiLeft + 100, guiTop + 50 + 13 * i, 40, fontRendererObj.FONT_HEIGHT + 1);
        addWidget(coordFields[i]);
        coordFields[i].setEnabled(gpsButton.enabled);
    }
    coordFields[0].setValue(widget.getRawCoordinate().chunkPosX);
    coordFields[1].setValue(widget.getRawCoordinate().chunkPosY);
    coordFields[2].setValue(widget.getRawCoordinate().chunkPosZ);
    variableField = new WidgetComboBox(fontRendererObj, guiLeft + 90, guiTop + 112, 80, fontRendererObj.FONT_HEIGHT + 1);
    variableField.setElements(guiProgrammer.te.getAllVariables());
    addWidget(variableField);
    variableField.setText(widget.getVariable());
    variableField.setEnabled(widget.isUsingVariable());
}
Also used : WidgetTextFieldNumber(pneumaticCraft.client.gui.widget.WidgetTextFieldNumber) ChunkPosition(net.minecraft.world.ChunkPosition) ArrayList(java.util.ArrayList) GuiRadioButton(pneumaticCraft.client.gui.widget.GuiRadioButton) ItemStack(net.minecraft.item.ItemStack) WidgetComboBox(pneumaticCraft.client.gui.widget.WidgetComboBox) GuiButtonSpecial(pneumaticCraft.client.gui.GuiButtonSpecial)

Example 3 with WidgetComboBox

use of pneumaticCraft.client.gui.widget.WidgetComboBox in project PneumaticCraft by MineMaarten.

the class GuiProgWidgetItemAssign method initGui.

@Override
public void initGui() {
    super.initGui();
    textfield = new WidgetComboBox(fontRendererObj, guiLeft + 10, guiTop + 40, 160, 10);
    textfield.setElements(guiProgrammer.te.getAllVariables());
    textfield.setMaxStringLength(1000);
    textfield.setText(widget.getVariable());
    addWidget(textfield);
    addWidget(new WidgetLabel(guiLeft + 10, guiTop + 30, "Setting variable:"));
}
Also used : WidgetLabel(pneumaticCraft.client.gui.widget.WidgetLabel) WidgetComboBox(pneumaticCraft.client.gui.widget.WidgetComboBox)

Example 4 with WidgetComboBox

use of pneumaticCraft.client.gui.widget.WidgetComboBox in project PneumaticCraft by MineMaarten.

the class GuiRemoteVariable method initGui.

@Override
public void initGui() {
    super.initGui();
    addLabel(I18n.format("gui.progWidget.coordinate.variableName"), guiLeft + 10, guiTop + 70);
    addLabel("#", guiLeft + 10, guiTop + 81);
    variableField = new WidgetComboBox(fontRendererObj, guiLeft + 18, guiTop + 80, 152, 10);
    variableField.setElements(((ContainerRemote) guiRemote.inventorySlots).variables);
    variableField.setText(widget.getVariableName());
    variableField.setTooltip(I18n.format("gui.remote.variable.tooltip"));
    addWidget(variableField);
}
Also used : WidgetComboBox(pneumaticCraft.client.gui.widget.WidgetComboBox)

Example 5 with WidgetComboBox

use of pneumaticCraft.client.gui.widget.WidgetComboBox in project PneumaticCraft by MineMaarten.

the class GuiProgWidgetArea method initGui.

@Override
public void initGui() {
    super.initGui();
    addLabel("Point 1", guiLeft + 50, guiTop + 10);
    addLabel("Point 2", guiLeft + 177, guiTop + 10);
    addLabel("Area Type:", guiLeft + 4, guiTop + 50);
    boolean advancedMode = Config.getProgrammerDifficulty() == 2;
    GuiButtonSpecial gpsButton1 = new GuiButtonSpecial(0, guiLeft + (advancedMode ? 6 : 55), guiTop + 20, 20, 20, "");
    GuiButtonSpecial gpsButton2 = new GuiButtonSpecial(1, guiLeft + (advancedMode ? 133 : 182), guiTop + 20, 20, 20, "");
    gpsButton1.setTooltipText(I18n.format("gui.progWidget.area.selectGPS1"));
    gpsButton2.setTooltipText(I18n.format("gui.progWidget.area.selectGPS2"));
    gpsButton1.setRenderStacks(new ItemStack(Itemss.GPSTool));
    gpsButton2.setRenderStacks(new ItemStack(Itemss.GPSTool));
    buttonList.add(gpsButton1);
    buttonList.add(gpsButton2);
    variableField1 = new WidgetComboBox(fontRendererObj, guiLeft + 28, guiTop + 25, 88, fontRendererObj.FONT_HEIGHT + 1);
    variableField2 = new WidgetComboBox(fontRendererObj, guiLeft + 155, guiTop + 25, 88, fontRendererObj.FONT_HEIGHT + 1);
    Set<String> variables = guiProgrammer.te.getAllVariables();
    variableField1.setElements(variables);
    variableField2.setElements(variables);
    variableField1.setText(widget.getCoord1Variable());
    variableField2.setText(widget.getCoord2Variable());
    typeInfoField = new WidgetTextFieldNumber(fontRendererObj, guiLeft + 160, guiTop + 110, 20, fontRendererObj.FONT_HEIGHT + 1);
    typeInfoField.setValue(widget.typeInfo);
    typeInfoField.setTooltip(I18n.format("gui.progWidget.area.extraInfo.tooltip"));
    addWidget(typeInfoField);
    addWidget(new WidgetLabel(guiLeft + 160, guiTop + 100, I18n.format("gui.progWidget.area.extraInfo")));
    if (advancedMode) {
        addWidget(variableField1);
        addWidget(variableField2);
    }
    List<GuiRadioButton> radioButtons = new ArrayList<GuiRadioButton>();
    ProgWidgetArea.EnumAreaType[] areaTypes = ProgWidgetArea.EnumAreaType.values();
    for (int i = 0; i < areaTypes.length; i++) {
        GuiRadioButton radioButton = new GuiRadioButton(i, guiLeft + 7 + i / 7 * 80, guiTop + 60 + i % 7 * 12, 0xFF000000, areaTypes[i].toString());
        radioButton.checked = areaTypes[i] == widget.type;
        addWidget(radioButton);
        radioButtons.add(radioButton);
        radioButton.otherChoices = radioButtons;
    }
    if (invSearchGui != null) {
        ChunkPosition pos = invSearchGui.getSearchStack() != null ? ItemGPSTool.getGPSLocation(invSearchGui.getSearchStack()) : null;
        if (pos != null) {
            if (pointSearched == 0) {
                widget.x1 = pos.chunkPosX;
                widget.y1 = pos.chunkPosY;
                widget.z1 = pos.chunkPosZ;
            } else {
                widget.x2 = pos.chunkPosX;
                widget.y2 = pos.chunkPosY;
                widget.z2 = pos.chunkPosZ;
            }
        } else {
            if (pointSearched == 0) {
                widget.x1 = widget.y1 = widget.z1 = 0;
            } else {
                widget.x2 = widget.y2 = widget.z2 = 0;
            }
        }
    }
}
Also used : WidgetLabel(pneumaticCraft.client.gui.widget.WidgetLabel) WidgetTextFieldNumber(pneumaticCraft.client.gui.widget.WidgetTextFieldNumber) ChunkPosition(net.minecraft.world.ChunkPosition) ArrayList(java.util.ArrayList) GuiButtonSpecial(pneumaticCraft.client.gui.GuiButtonSpecial) GuiRadioButton(pneumaticCraft.client.gui.widget.GuiRadioButton) ItemStack(net.minecraft.item.ItemStack) WidgetComboBox(pneumaticCraft.client.gui.widget.WidgetComboBox)

Aggregations

WidgetComboBox (pneumaticCraft.client.gui.widget.WidgetComboBox)10 ArrayList (java.util.ArrayList)3 ItemStack (net.minecraft.item.ItemStack)3 GuiRadioButton (pneumaticCraft.client.gui.widget.GuiRadioButton)3 WidgetTextFieldNumber (pneumaticCraft.client.gui.widget.WidgetTextFieldNumber)3 ChunkPosition (net.minecraft.world.ChunkPosition)2 GuiButtonSpecial (pneumaticCraft.client.gui.GuiButtonSpecial)2 GuiCheckBox (pneumaticCraft.client.gui.widget.GuiCheckBox)2 WidgetLabel (pneumaticCraft.client.gui.widget.WidgetLabel)2 GuiButton (net.minecraft.client.gui.GuiButton)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)1 WidgetTextField (pneumaticCraft.client.gui.widget.WidgetTextField)1 PacketUpdateRemoteLayout (pneumaticCraft.common.network.PacketUpdateRemoteLayout)1 ActionWidget (pneumaticCraft.common.remote.ActionWidget)1 ActionWidgetButton (pneumaticCraft.common.remote.ActionWidgetButton)1 ActionWidgetCheckBox (pneumaticCraft.common.remote.ActionWidgetCheckBox)1 ActionWidgetDropdown (pneumaticCraft.common.remote.ActionWidgetDropdown)1 ActionWidgetLabel (pneumaticCraft.common.remote.ActionWidgetLabel)1 IActionWidgetLabeled (pneumaticCraft.common.remote.IActionWidgetLabeled)1