Search in sources :

Example 1 with WidgetTextFieldNumber

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

the class GuiGPSTool method initGui.

@Override
public void initGui() {
    super.initGui();
    int[] oldText = new int[3];
    if (textFields[0] == null) {
        oldText[0] = oldGPSLoc.chunkPosX;
        oldText[1] = oldGPSLoc.chunkPosY;
        oldText[2] = oldGPSLoc.chunkPosZ;
    } else {
        for (int i = 0; i < 3; i++) oldText[i] = textFields[i].getValue();
    }
    int xMiddle = width / 2;
    int yMiddle = height / 2;
    for (int i = 0; i < 3; i++) {
        textFields[i] = new WidgetTextFieldNumber(fontRendererObj, xMiddle - TEXTFIELD_WIDTH / 2, yMiddle - 27 + i * 22, TEXTFIELD_WIDTH, fontRendererObj.FONT_HEIGHT);
        textFields[i].setValue(oldText[i]);
        if (i == 1) {
            textFields[i].minValue = 0;
            textFields[i].maxValue = 255;
        }
        addWidget(textFields[i]);
    }
    for (int i = 0; i < 3; i++) {
        buttonList.add(new GuiButton(0 + i * 4, xMiddle - 49 - TEXTFIELD_WIDTH / 2, yMiddle - 32 + i * 22, 22, 20, "-10"));
        buttonList.add(new GuiButton(1 + i * 4, xMiddle - 25 - TEXTFIELD_WIDTH / 2, yMiddle - 32 + i * 22, 22, 20, "-1"));
        buttonList.add(new GuiButton(2 + i * 4, xMiddle + 3 + TEXTFIELD_WIDTH / 2, yMiddle - 32 + i * 22, 22, 20, "+1"));
        buttonList.add(new GuiButton(3 + i * 4, xMiddle + 27 + TEXTFIELD_WIDTH / 2, yMiddle - 32 + i * 22, 22, 20, "+10"));
    }
    if (variableField != null)
        oldVarName = variableField.getText();
    variableField = new WidgetTextField(fontRendererObj, xMiddle - 50, yMiddle + 60, 100, fontRendererObj.FONT_HEIGHT);
    variableField.setText(oldVarName);
    addWidget(variableField);
    String var = I18n.format("gui.progWidget.coordinate.variable");
    addLabel(var, xMiddle - 62 - fontRendererObj.getStringWidth(var), yMiddle + 61);
    addLabel("#", xMiddle - 60, yMiddle + 61);
}
Also used : WidgetTextFieldNumber(pneumaticCraft.client.gui.widget.WidgetTextFieldNumber) GuiButton(net.minecraft.client.gui.GuiButton) WidgetTextField(pneumaticCraft.client.gui.widget.WidgetTextField)

Example 2 with WidgetTextFieldNumber

use of pneumaticCraft.client.gui.widget.WidgetTextFieldNumber 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 WidgetTextFieldNumber

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

the class GuiProgWidgetDigAndPlace method initGui.

@Override
public void initGui() {
    super.initGui();
    List<GuiRadioButton> radioButtons = new ArrayList<GuiRadioButton>();
    ProgWidgetDigAndPlace.EnumOrder[] orders = ProgWidgetDigAndPlace.EnumOrder.values();
    for (int i = 0; i < orders.length; i++) {
        GuiRadioButton radioButton = new GuiRadioButton(i, guiLeft + 4, guiTop + 30 + i * 12, 0xFF000000, orders[i].getLocalizedName());
        radioButton.checked = orders[i] == widget.getOrder();
        addWidget(radioButton);
        radioButtons.add(radioButton);
        radioButton.otherChoices = radioButtons;
    }
    useMaxActions = new GuiCheckBox(16, guiLeft + (moveActionsToSide() ? 54 : 4), guiTop + 115, 0xFF000000, I18n.format("gui.progWidget.digAndPlace.useMaxActions"));
    useMaxActions.setTooltip("gui.progWidget.digAndPlace.useMaxActions.tooltip");
    useMaxActions.checked = widget.useMaxActions();
    addWidget(useMaxActions);
    textField = new WidgetTextFieldNumber(Minecraft.getMinecraft().fontRenderer, guiLeft + (moveActionsToSide() ? 57 : 7), guiTop + 128, 50, 11);
    textField.setValue(widget.getMaxActions());
    textField.setEnabled(useMaxActions.checked);
    addWidget(textField);
}
Also used : WidgetTextFieldNumber(pneumaticCraft.client.gui.widget.WidgetTextFieldNumber) ArrayList(java.util.ArrayList) GuiRadioButton(pneumaticCraft.client.gui.widget.GuiRadioButton) GuiCheckBox(pneumaticCraft.client.gui.widget.GuiCheckBox)

Example 4 with WidgetTextFieldNumber

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

the class GuiAmadronAddTrade method initGui.

@Override
public void initGui() {
    super.initGui();
    ContainerAmadronAddTrade container = (ContainerAmadronAddTrade) inventorySlots;
    addLabel(I18n.format("gui.amadron.addTrade.selling"), guiLeft + 4, guiTop + 5);
    addLabel(I18n.format("gui.amadron.addTrade.buying"), guiLeft + 93, guiTop + 5);
    buttonList.add(new GuiButton(0, guiLeft + 4, guiTop + 20, 85, 20, "Search item..."));
    buttonList.add(new GuiButton(1, guiLeft + 4, guiTop + 42, 85, 20, "Search inv..."));
    buttonList.add(new GuiButton(2, guiLeft + 4, guiTop + 64, 85, 20, "Search fluid..."));
    buttonList.add(new GuiButton(3, guiLeft + 93, guiTop + 20, 85, 20, "Search item..."));
    buttonList.add(new GuiButton(4, guiLeft + 93, guiTop + 42, 85, 20, "Search inv..."));
    buttonList.add(new GuiButton(5, guiLeft + 93, guiTop + 64, 85, 20, "Search fluid..."));
    buttonList.add(addButton = new GuiButton(8, guiLeft + 50, guiTop + 164, 85, 20, "Add Trade"));
    Fluid oldInputFluid = inputFluid != null ? inputFluid.getFluid() : null;
    Fluid oldOutputFluid = outputFluid != null ? outputFluid.getFluid() : null;
    inputFluid = new WidgetFluidFilter(-1, guiLeft + 10, guiTop + 90);
    outputFluid = new WidgetFluidFilter(-1, guiLeft + 99, guiTop + 90);
    inputFluid.setFluid(oldInputFluid);
    outputFluid.setFluid(oldOutputFluid);
    addWidget(inputFluid);
    addWidget(outputFluid);
    GuiButtonSpecial gpsButton1 = new GuiButtonSpecial(6, guiLeft + 10, guiTop + 115, 20, 20, "");
    GuiButtonSpecial gpsButton2 = new GuiButtonSpecial(7, guiLeft + 99, guiTop + 115, 20, 20, "");
    gpsButton1.setTooltipText(Arrays.asList(WordUtils.wrap(I18n.format("gui.amadron.button.selectSellingBlock.tooltip"), 40).split(System.getProperty("line.separator"))));
    gpsButton2.setTooltipText(Arrays.asList(WordUtils.wrap(I18n.format("gui.amadron.button.selectPaymentBlock.tooltip"), 40).split(System.getProperty("line.separator"))));
    gpsButton1.setRenderStacks(new ItemStack(Itemss.GPSTool));
    gpsButton2.setRenderStacks(new ItemStack(Itemss.GPSTool));
    addWidget(gpsButton1);
    addWidget(gpsButton2);
    inputNumber = new WidgetTextFieldNumber(fontRendererObj, guiLeft + 6, guiTop + 145, 40, fontRendererObj.FONT_HEIGHT).setValue(inputNumber != null ? inputNumber.getValue() : 0);
    outputNumber = new WidgetTextFieldNumber(fontRendererObj, guiLeft + 95, guiTop + 145, 40, fontRendererObj.FONT_HEIGHT).setValue(outputNumber != null ? outputNumber.getValue() : 0);
    inputNumber.setTooltip(I18n.format("gui.amadron.addTrade.itemFluidAmount"));
    outputNumber.setTooltip(I18n.format("gui.amadron.addTrade.itemFluidAmount"));
    addWidget(inputNumber);
    addWidget(outputNumber);
    if (searchGui != null) {
        if (isSettingInput) {
            inputFluid.setFluid(null);
            container.setStack(0, searchGui.getSearchStack());
        } else {
            outputFluid.setFluid(null);
            container.setStack(1, searchGui.getSearchStack());
        }
    }
    if (invSearchGui != null) {
        if (isSettingInput) {
            inputFluid.setFluid(null);
            container.setStack(0, invSearchGui.getSearchStack());
        } else {
            outputFluid.setFluid(null);
            container.setStack(1, invSearchGui.getSearchStack());
        }
    }
    if (fluidGui != null) {
        if (isSettingInput) {
            container.setStack(0, null);
            inputFluid.setFluid(fluidGui.getFilter());
        } else {
            container.setStack(1, null);
            outputFluid.setFluid(fluidGui.getFilter());
        }
    }
    if (gpsSearchGui != null) {
        if (isSettingInput) {
            inputPosition = gpsSearchGui.getSearchStack() != null ? ItemGPSTool.getGPSLocation(gpsSearchGui.getSearchStack()) : null;
        } else {
            outputPosition = gpsSearchGui.getSearchStack() != null ? ItemGPSTool.getGPSLocation(gpsSearchGui.getSearchStack()) : null;
        }
    }
    searchGui = null;
    fluidGui = null;
    invSearchGui = null;
    gpsSearchGui = null;
    inputNumberLabel = new WidgetLabel(guiLeft + 52, guiTop + 145, container.getStack(0) != null ? "x" : inputFluid.getFluid() != null ? "mB" : "");
    outputNumberLabel = new WidgetLabel(guiLeft + 149, guiTop + 145, container.getStack(1) != null ? "x" : outputFluid.getFluid() != null ? "mB" : "");
    addWidget(inputNumberLabel);
    addWidget(outputNumberLabel);
}
Also used : WidgetLabel(pneumaticCraft.client.gui.widget.WidgetLabel) ContainerAmadronAddTrade(pneumaticCraft.common.inventory.ContainerAmadronAddTrade) GuiButton(net.minecraft.client.gui.GuiButton) WidgetTextFieldNumber(pneumaticCraft.client.gui.widget.WidgetTextFieldNumber) Fluid(net.minecraftforge.fluids.Fluid) WidgetFluidFilter(pneumaticCraft.client.gui.widget.WidgetFluidFilter) ItemStack(net.minecraft.item.ItemStack)

Example 5 with WidgetTextFieldNumber

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

the class GuiKeroseneLamp method initGui.

@Override
public void initGui() {
    super.initGui();
    addWidget(new WidgetTank(-1, guiLeft + 152, guiTop + 15, te.getTank()));
    addWidget(rangeTextWidget = new WidgetLabel(guiLeft + 5, guiTop + 38, ""));
    //  addWidget(timeLeftWidget = new WidgetLabel(guiLeft + 5, guiTop + 26, ""));
    String maxRange = I18n.format("gui.keroseneLamp.maxRange");
    int maxRangeLength = fontRendererObj.getStringWidth(maxRange);
    addLabel(maxRange, guiLeft + 5, guiTop + 50);
    addLabel(I18n.format("gui.keroseneLamp.blocks"), guiLeft + maxRangeLength + 40, guiTop + 50);
    addWidget(rangeWidget = new WidgetTextFieldNumber(fontRendererObj, guiLeft + 7 + maxRangeLength, guiTop + 50, 30, fontRendererObj.FONT_HEIGHT));
    rangeWidget.minValue = 1;
    rangeWidget.maxValue = 30;
}
Also used : WidgetLabel(pneumaticCraft.client.gui.widget.WidgetLabel) WidgetTextFieldNumber(pneumaticCraft.client.gui.widget.WidgetTextFieldNumber) WidgetTank(pneumaticCraft.client.gui.widget.WidgetTank)

Aggregations

WidgetTextFieldNumber (pneumaticCraft.client.gui.widget.WidgetTextFieldNumber)11 ArrayList (java.util.ArrayList)3 ItemStack (net.minecraft.item.ItemStack)3 GuiButtonSpecial (pneumaticCraft.client.gui.GuiButtonSpecial)3 GuiCheckBox (pneumaticCraft.client.gui.widget.GuiCheckBox)3 GuiRadioButton (pneumaticCraft.client.gui.widget.GuiRadioButton)3 WidgetComboBox (pneumaticCraft.client.gui.widget.WidgetComboBox)3 WidgetLabel (pneumaticCraft.client.gui.widget.WidgetLabel)3 WidgetTextField (pneumaticCraft.client.gui.widget.WidgetTextField)3 GuiButton (net.minecraft.client.gui.GuiButton)2 ChunkPosition (net.minecraft.world.ChunkPosition)2 Fluid (net.minecraftforge.fluids.Fluid)1 WidgetFluidFilter (pneumaticCraft.client.gui.widget.WidgetFluidFilter)1 WidgetTank (pneumaticCraft.client.gui.widget.WidgetTank)1 TubeModuleRedstoneReceiving (pneumaticCraft.common.block.tubes.TubeModuleRedstoneReceiving)1 ContainerAmadronAddTrade (pneumaticCraft.common.inventory.ContainerAmadronAddTrade)1 ProgWidgetInventoryBase (pneumaticCraft.common.progwidgets.ProgWidgetInventoryBase)1 IActionWidgetLabeled (pneumaticCraft.common.remote.IActionWidgetLabeled)1