Search in sources :

Example 1 with GuiButtonSpecial

use of me.desht.pneumaticcraft.client.gui.GuiButtonSpecial in project pnc-repressurized by TeamPneumatic.

the class GuiPressureModuleSimple method initGui.

@Override
public void initGui() {
    super.initGui();
    String title = I18n.format("item." + module.getType() + ".name");
    addLabel(title, width / 2 - fontRenderer.getStringWidth(title) / 2, guiTop + 5);
    advancedMode = new GuiCheckBox(0, guiLeft + 6, guiTop + 15, 0xFF404040, "gui.tubeModule.advancedConfig").setTooltip(I18n.format("gui.tubeModule.advancedConfig.tooltip"));
    advancedMode.checked = false;
    addWidget(advancedMode);
    thresholdField = new WidgetTextFieldNumber(fontRenderer, guiLeft + 110, guiTop + 33, 30, fontRenderer.FONT_HEIGHT).setDecimals(1);
    addWidget(thresholdField);
    if (module instanceof TubeModuleRedstoneReceiving) {
        thresholdField.setValue(((TubeModuleRedstoneReceiving) module).getThreshold());
        addLabel(I18n.format("gui.tubeModule.simpleConfig.threshold"), guiLeft + 6, guiTop + 33);
    } else {
        thresholdField.setValue(module.lowerBound);
        addLabel(I18n.format("gui.tubeModule.simpleConfig.turn"), guiLeft + 6, guiTop + 33);
        moreOrLessButton = new GuiButtonSpecial(1, guiLeft + 85, guiTop + 28, 20, 20, module.lowerBound < module.higherBound ? ">" : "<");
        moreOrLessButton.setTooltipText(I18n.format(module.lowerBound < module.higherBound ? "gui.tubeModule.simpleConfig.higherThan" : "gui.tubeModule.simpleConfig.lowerThan"));
        addWidget(moreOrLessButton);
    }
    addLabel(I18n.format("gui.general.bar"), guiLeft + 145, guiTop + 34);
}
Also used : WidgetTextFieldNumber(me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber) TubeModuleRedstoneReceiving(me.desht.pneumaticcraft.common.block.tubes.TubeModuleRedstoneReceiving) GuiCheckBox(me.desht.pneumaticcraft.client.gui.widget.GuiCheckBox) GuiButtonSpecial(me.desht.pneumaticcraft.client.gui.GuiButtonSpecial)

Example 2 with GuiButtonSpecial

use of me.desht.pneumaticcraft.client.gui.GuiButtonSpecial in project pnc-repressurized by TeamPneumatic.

the class ActionWidgetButton method readFromNBT.

@Override
public void readFromNBT(NBTTagCompound tag, int guiLeft, int guiTop) {
    super.readFromNBT(tag, guiLeft, guiTop);
    widget = new GuiButtonSpecial(-1, tag.getInteger("x") + guiLeft, tag.getInteger("y") + guiTop, tag.getInteger("width"), tag.getInteger("height"), tag.getString("text"));
    settingCoordinate = new BlockPos(tag.getInteger("settingX"), tag.getInteger("settingY"), tag.getInteger("settingZ"));
    widget.setTooltipText(tag.getString("tooltip"));
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) GuiButtonSpecial(me.desht.pneumaticcraft.client.gui.GuiButtonSpecial)

Example 3 with GuiButtonSpecial

use of me.desht.pneumaticcraft.client.gui.GuiButtonSpecial in project pnc-repressurized by TeamPneumatic.

the class GuiProgWidgetArea method initGui.

@Override
public void initGui() {
    super.initGui();
    addLabel(I18n.format("gui.progWidget.area.point1"), guiLeft + 50, guiTop + 10);
    addLabel(I18n.format("gui.progWidget.area.point2"), guiLeft + 177, guiTop + 10);
    addLabel(I18n.format("gui.progWidget.area.type"), guiLeft + 4, guiTop + 50);
    boolean advancedMode = ConfigHandler.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.setRenderStacks(new ItemStack(Itemss.GPS_TOOL));
    gpsButton2.setRenderStacks(new ItemStack(Itemss.GPS_TOOL));
    buttonList.add(gpsButton1);
    buttonList.add(gpsButton2);
    variableField1 = new WidgetComboBox(fontRenderer, guiLeft + 28, guiTop + 25, 88, fontRenderer.FONT_HEIGHT + 1);
    variableField2 = new WidgetComboBox(fontRenderer, guiLeft + 155, guiTop + 25, 88, fontRenderer.FONT_HEIGHT + 1);
    Set<String> variables = guiProgrammer == null ? Collections.emptySet() : guiProgrammer.te.getAllVariables();
    variableField1.setElements(variables);
    variableField2.setElements(variables);
    variableField1.setText(widget.getCoord1Variable());
    variableField2.setText(widget.getCoord2Variable());
    if (advancedMode) {
        addWidget(variableField1);
        addWidget(variableField2);
    }
    final int widgetsPerColumn = 5;
    List<GuiRadioButton> radioButtons = new ArrayList<>();
    for (int i = 0; i < allAreaTypes.size(); i++) {
        AreaType areaType = allAreaTypes.get(i);
        GuiRadioButton radioButton = new GuiRadioButton(i, guiLeft + widgetsPerColumn + i / widgetsPerColumn * 80, guiTop + 60 + i % widgetsPerColumn * 12, 0xFF404040, areaType.getName());
        if (widget.type.getClass() == areaType.getClass()) {
            allAreaTypes.set(i, widget.type);
            radioButton.checked = true;
        }
        addWidget(radioButton);
        radioButtons.add(radioButton);
        radioButton.otherChoices = radioButtons;
    }
    // typeInfoField.setTooltip(I18n.format("gui.progWidget.area.extraInfo.tooltip"));
    // addWidget(new WidgetLabel(guiLeft + 160, guiTop + 100, I18n.format("gui.progWidget.area.extraInfo")));
    switchToWidgets(widget.type);
    if (invSearchGui != null) {
        BlockPos pos = !invSearchGui.getSearchStack().isEmpty() ? ItemGPSTool.getGPSLocation(invSearchGui.getSearchStack()) : null;
        if (pos != null) {
            if (pointSearched == 0) {
                widget.x1 = pos.getX();
                widget.y1 = pos.getY();
                widget.z1 = pos.getZ();
            } else {
                widget.x2 = pos.getX();
                widget.y2 = pos.getY();
                widget.z2 = pos.getZ();
            }
        } else {
            if (pointSearched == 0) {
                widget.x1 = widget.y1 = widget.z1 = 0;
            } else {
                widget.x2 = widget.y2 = widget.z2 = 0;
            }
        }
    }
    List<String> b1List = Lists.newArrayList(I18n.format("gui.progWidget.area.selectGPS1"));
    if (widget.x1 != 0 || widget.y1 != 0 || widget.z1 != 0) {
        b1List.add(String.format(TextFormatting.GRAY + "[Current] %d, %d, %d", widget.x1, widget.y1, widget.z1));
    }
    gpsButton1.setTooltipText(b1List);
    List<String> b2List = Lists.newArrayList(I18n.format("gui.progWidget.area.selectGPS2"));
    if (widget.x2 != 0 || widget.y2 != 0 || widget.z2 != 0) {
        b2List.add(String.format(TextFormatting.GRAY + "[Current] %d, %d, %d", widget.x2, widget.y2, widget.z2));
    }
    gpsButton2.setTooltipText(b2List);
}
Also used : ArrayList(java.util.ArrayList) AreaType(me.desht.pneumaticcraft.common.progwidgets.area.AreaType) GuiButtonSpecial(me.desht.pneumaticcraft.client.gui.GuiButtonSpecial) GuiRadioButton(me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack) WidgetComboBox(me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)

Example 4 with GuiButtonSpecial

use of me.desht.pneumaticcraft.client.gui.GuiButtonSpecial in project pnc-repressurized by TeamPneumatic.

the class GuiProgWidgetCoordinate method initGui.

@Override
public void initGui() {
    super.initGui();
    if (invSearchGui != null) {
        BlockPos pos = !invSearchGui.getSearchStack().isEmpty() ? ItemGPSTool.getGPSLocation(invSearchGui.getSearchStack()) : null;
        widget.setCoordinate(pos);
    }
    List<GuiRadioButton> radioButtons = new ArrayList<GuiRadioButton>();
    GuiRadioButton radioButton = new GuiRadioButton(0, guiLeft + 7, guiTop + 51, 0xFF404040, 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, 0xFF404040, 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(Itemss.GPS_TOOL));
    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(fontRenderer, guiLeft + 100, guiTop + 50 + 13 * i, 40, fontRenderer.FONT_HEIGHT + 1);
        addWidget(coordFields[i]);
        coordFields[i].setEnabled(gpsButton.enabled);
    }
    coordFields[0].setValue(widget.getRawCoordinate().getX());
    coordFields[1].setValue(widget.getRawCoordinate().getY());
    coordFields[2].setValue(widget.getRawCoordinate().getZ());
    variableField = new WidgetComboBox(fontRenderer, guiLeft + 90, guiTop + 112, 80, fontRenderer.FONT_HEIGHT + 1);
    variableField.setElements(guiProgrammer.te.getAllVariables());
    addWidget(variableField);
    variableField.setText(widget.getVariable());
    variableField.setEnabled(widget.isUsingVariable());
}
Also used : ArrayList(java.util.ArrayList) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack) GuiButtonSpecial(me.desht.pneumaticcraft.client.gui.GuiButtonSpecial)

Aggregations

GuiButtonSpecial (me.desht.pneumaticcraft.client.gui.GuiButtonSpecial)4 BlockPos (net.minecraft.util.math.BlockPos)3 ArrayList (java.util.ArrayList)2 ItemStack (net.minecraft.item.ItemStack)2 GuiCheckBox (me.desht.pneumaticcraft.client.gui.widget.GuiCheckBox)1 GuiRadioButton (me.desht.pneumaticcraft.client.gui.widget.GuiRadioButton)1 WidgetComboBox (me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)1 WidgetTextFieldNumber (me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber)1 TubeModuleRedstoneReceiving (me.desht.pneumaticcraft.common.block.tubes.TubeModuleRedstoneReceiving)1 AreaType (me.desht.pneumaticcraft.common.progwidgets.area.AreaType)1