Search in sources :

Example 61 with GuiButton

use of net.minecraft.client.gui.GuiButton 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 62 with GuiButton

use of net.minecraft.client.gui.GuiButton in project PneumaticCraft by MineMaarten.

the class GuiCoordinateTrackerOptions method initGui.

@Override
public void initGui(IGuiScreen gui) {
    gui.getButtonList().add(new GuiButton(10, 30, 40, 150, 20, "Select Target..."));
    gui.getButtonList().add(new GuiButton(11, 30, 62, 150, 20, "Navigate to Surface..."));
    pathEnabled = new GuiButton(12, 30, 128, 150, 20, "");
    wirePath = new GuiButton(13, 30, 150, 150, 20, "");
    xRayEnabled = new GuiButton(14, 30, 172, 150, 20, "");
    pathUpdateRate = new GuiButton(15, 30, 194, 150, 20, "");
    gui.getButtonList().add(pathEnabled);
    gui.getButtonList().add(wirePath);
    gui.getButtonList().add(xRayEnabled);
    gui.getButtonList().add(pathUpdateRate);
    updateButtonTexts();
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton)

Example 63 with GuiButton

use of net.minecraft.client.gui.GuiButton in project PneumaticCraft by MineMaarten.

the class GuiHelmetMainOptions method initGui.

@Override
public void initGui(IGuiScreen gui) {
    gui.getButtonList().add(new GuiButton(10, 30, 128, 150, 20, "Move Pressure Stat Screen..."));
    gui.getButtonList().add(new GuiButton(11, 30, 150, 150, 20, "Move Message Screen..."));
    if (!Loader.isModLoaded(ModIds.NOT_ENOUGH_KEYS)) {
        changeKeybindingButton = new GuiButton(12, 30, 172, 150, 20, "Change open menu key...");
        gui.getButtonList().add(changeKeybindingButton);
    }
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton)

Example 64 with GuiButton

use of net.minecraft.client.gui.GuiButton in project PneumaticCraft by MineMaarten.

the class GuiHelmetMainScreen method initGui.

@Override
public void initGui() {
    super.initGui();
    buttonList.clear();
    upgradePages.clear();
    upgradePageNames.clear();
    addPages();
    for (int i = 0; i < upgradePages.size(); i++) {
        GuiButton button = new GuiButton(100 + i, 210, 20 + i * 22, 200, 20, upgradePages.get(i).getPageName());
        if (page == i)
            button.enabled = false;
        buttonList.add(button);
    }
    if (page > upgradePages.size() - 1)
        page = upgradePages.size() - 1;
    GuiKeybindCheckBox checkBox = new GuiKeybindCheckBox(100, 40, 12, 0xFFFFFFFF, I18n.format("gui.enableModule", I18n.format("pneumaticHelmet.upgrade." + upgradePageNames.get(page))), "pneumaticHelmet.upgrade." + upgradePageNames.get(page));
    if (upgradePages.get(page).canBeTurnedOff())
        addWidget(checkBox);
    upgradePages.get(page).initGui(this);
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) GuiKeybindCheckBox(pneumaticCraft.client.gui.widget.GuiKeybindCheckBox)

Example 65 with GuiButton

use of net.minecraft.client.gui.GuiButton in project PneumaticCraft by MineMaarten.

the class GuiUniversalSensor method updateButtons.

public void updateButtons() {
    buttonList.clear();
    buttonList.add(redstoneButton);
    if (!te.getSensorSetting().equals("")) {
        buttonList.add(new GuiButton(1, guiLeft + 70, guiTop + 18, 30, 20, "back"));
    } else {
        buttonList.add(new GuiButton(-1, guiLeft + 70, guiTop + 125, 98, 20, I18n.format("gui.universalSensor.button.showRange")));
    }
    String[] directories = SensorHandler.instance().getDirectoriesAtLocation(te.getSensorSetting());
    maxPage = (directories.length - 1) / MAX_SENSORS_PER_PAGE + 1;
    if (page > maxPage)
        page = maxPage;
    if (page < 1)
        page = 1;
    if (maxPage > 1) {
        buttonList.add(new GuiButton(2, guiLeft + 70, guiTop + 40 + 22 * MAX_SENSORS_PER_PAGE, 30, 20, "<--"));
        buttonList.add(new GuiButton(3, guiLeft + 138, guiTop + 40 + 22 * MAX_SENSORS_PER_PAGE, 30, 20, "-->"));
    }
    int buttonsOnPage = MAX_SENSORS_PER_PAGE;
    if (page == maxPage && (directories.length % MAX_SENSORS_PER_PAGE > 0 || directories.length == 0)) {
        buttonsOnPage = directories.length % MAX_SENSORS_PER_PAGE;
    }
    for (int i = 0; i < buttonsOnPage; i++) {
        String buttonText = directories[i + (page - 1) * MAX_SENSORS_PER_PAGE];
        if (SensorHandler.instance().getSensorFromPath(te.getSensorSetting() + "/" + buttonText) != null) {
            buttonText = EnumChatFormatting.YELLOW + buttonText;
        }
        int buttonID = i * 10 + 10 + (page - 1) * MAX_SENSORS_PER_PAGE * 10;
        int buttonX = guiLeft + 70;
        int buttonY = guiTop + 40 + i * 22;
        int buttonWidth = 98;
        int buttonHeight = 20;
        if (te.getSensorSetting().equals("")) {
            ItemStack[] requiredStacks = SensorHandler.instance().getRequiredStacksFromText(buttonText);
            GuiButtonSpecial button = new GuiButtonSpecial(buttonID, buttonX, buttonY, buttonWidth, buttonHeight, "");
            button.setRenderStacks(requiredStacks);
            button.enabled = te.areGivenUpgradesInserted(requiredStacks);
            buttonList.add(button);
        } else {
            buttonList.add(new GuiButton(buttonID, buttonX, buttonY, buttonWidth, buttonHeight, buttonText));
        }
    }
    sensorInfoStat.setText(getSensorInfo());
    ISensorSetting sensor = SensorHandler.instance().getSensorFromPath(te.getSensorSetting());
    boolean textboxEnabled = sensor != null && sensor.needsTextBox();
    nameFilterField.setVisible(textboxEnabled);
    if (!textboxEnabled)
        nameFilterField.setFocused(false);
}
Also used : ISensorSetting(pneumaticCraft.api.universalSensor.ISensorSetting) GuiButton(net.minecraft.client.gui.GuiButton) ItemStack(net.minecraft.item.ItemStack) Point(java.awt.Point)

Aggregations

GuiButton (net.minecraft.client.gui.GuiButton)132 GuiTextField (net.minecraft.client.gui.GuiTextField)17 SmallGuiButton (logisticspipes.utils.gui.SmallGuiButton)12 ArrayList (java.util.ArrayList)10 ItemStack (net.minecraft.item.ItemStack)9 Point (java.awt.Point)7 GuiElementInfoRegionMP (stevekung.mods.moreplanets.util.client.gui.GuiElementInfoRegionMP)7 ItemDisplay (logisticspipes.utils.gui.ItemDisplay)6 GuiCheckBox (logisticspipes.utils.gui.GuiCheckBox)5 Bounds (ivorius.reccomplex.gui.table.Bounds)4 Rectangle (java.awt.Rectangle)4 SearchBar (logisticspipes.utils.gui.SearchBar)4 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)3 GuiButtonVariableDims (am2.guis.controls.GuiButtonVariableDims)2 GuiSlideControl (am2.guis.controls.GuiSlideControl)2 IOException (java.io.IOException)2 BitSet (java.util.BitSet)2 GuiDiskPopup (logisticspipes.gui.popup.GuiDiskPopup)2 RequestMonitorPopup (logisticspipes.gui.popup.RequestMonitorPopup)2 ClearCraftingGridPacket (logisticspipes.network.packets.block.ClearCraftingGridPacket)2