Search in sources :

Example 1 with WidgetLabel

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

the class GuiProgWidgetItemAssign method initGui.

@Override
public void initGui() {
    super.initGui();
    textfield = new WidgetComboBox(fontRenderer, 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(me.desht.pneumaticcraft.client.gui.widget.WidgetLabel) WidgetComboBox(me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)

Example 2 with WidgetLabel

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

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 = fontRenderer.getStringWidth(maxRange);
    addLabel(maxRange, guiLeft + 5, guiTop + 50);
    addLabel(I18n.format("gui.keroseneLamp.blocks"), guiLeft + maxRangeLength + 40, guiTop + 50);
    addWidget(rangeWidget = new WidgetTextFieldNumber(fontRenderer, guiLeft + 7 + maxRangeLength, guiTop + 50, 30, fontRenderer.FONT_HEIGHT));
    rangeWidget.minValue = 1;
    rangeWidget.maxValue = TileEntityKeroseneLamp.MAX_RANGE;
}
Also used : WidgetLabel(me.desht.pneumaticcraft.client.gui.widget.WidgetLabel) WidgetTextFieldNumber(me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber) WidgetTank(me.desht.pneumaticcraft.client.gui.widget.WidgetTank)

Example 3 with WidgetLabel

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

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.GPS_TOOL));
    gpsButton2.setRenderStacks(new ItemStack(Itemss.GPS_TOOL));
    addWidget(gpsButton1);
    addWidget(gpsButton2);
    inputNumber = new WidgetTextFieldNumber(fontRenderer, guiLeft + 6, guiTop + 145, 40, fontRenderer.FONT_HEIGHT).setValue(inputNumber != null ? inputNumber.getValue() : 0);
    outputNumber = new WidgetTextFieldNumber(fontRenderer, guiLeft + 95, guiTop + 145, 40, fontRenderer.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, ItemStack.EMPTY);
            inputFluid.setFluid(fluidGui.getFilter());
        } else {
            container.setStack(1, ItemStack.EMPTY);
            outputFluid.setFluid(fluidGui.getFilter());
        }
    }
    if (gpsSearchGui != null) {
        if (isSettingInput) {
            inputPosition = gpsSearchGui.getSearchStack().isEmpty() ? null : ItemGPSTool.getGPSLocation(gpsSearchGui.getSearchStack());
        } else {
            outputPosition = gpsSearchGui.getSearchStack().isEmpty() ? null : ItemGPSTool.getGPSLocation(gpsSearchGui.getSearchStack());
        }
    }
    searchGui = null;
    fluidGui = null;
    invSearchGui = null;
    gpsSearchGui = null;
    inputNumberLabel = new WidgetLabel(guiLeft + 52, guiTop + 145, container.getStack(0).isEmpty() ? inputFluid.getFluid() != null ? "mB" : "" : "x");
    outputNumberLabel = new WidgetLabel(guiLeft + 149, guiTop + 145, container.getStack(1).isEmpty() ? outputFluid.getFluid() != null ? "mB" : "" : "x");
    addWidget(inputNumberLabel);
    addWidget(outputNumberLabel);
}
Also used : WidgetLabel(me.desht.pneumaticcraft.client.gui.widget.WidgetLabel) ContainerAmadronAddTrade(me.desht.pneumaticcraft.common.inventory.ContainerAmadronAddTrade) GuiButton(net.minecraft.client.gui.GuiButton) WidgetTextFieldNumber(me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber) Fluid(net.minecraftforge.fluids.Fluid) WidgetFluidFilter(me.desht.pneumaticcraft.client.gui.widget.WidgetFluidFilter) ItemStack(net.minecraft.item.ItemStack)

Example 4 with WidgetLabel

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

the class GuiProgWidgetArea method switchToWidgets.

private void switchToWidgets(AreaType type) {
    saveWidgets();
    areaTypeValueWidgets.forEach(p -> removeWidget(p.getRight()));
    areaTypeStaticWidgets.forEach(w -> removeWidget(w));
    areaTypeValueWidgets.clear();
    areaTypeStaticWidgets.clear();
    int curY = guiTop + 60;
    int x = guiLeft + 150;
    List<AreaTypeWidget> widgets = new ArrayList<>();
    type.addUIWidgets(widgets);
    for (AreaTypeWidget widget : widgets) {
        WidgetLabel titleWidget = new WidgetLabel(x, curY, I18n.format(widget.title));
        addWidget(titleWidget);
        areaTypeStaticWidgets.add(titleWidget);
        curY += fontRenderer.FONT_HEIGHT + 1;
        if (widget instanceof AreaTypeWidgetInteger) {
            AreaTypeWidgetInteger intWidget = (AreaTypeWidgetInteger) widget;
            WidgetTextFieldNumber intField = new WidgetTextFieldNumber(fontRenderer, x, curY, 40, fontRenderer.FONT_HEIGHT + 1);
            intField.setValue(intWidget.readAction.get());
            addWidget(intField);
            areaTypeValueWidgets.add(new ImmutablePair<AreaType.AreaTypeWidget, IGuiWidget>(widget, intField));
            curY += fontRenderer.FONT_HEIGHT + 20;
        } else if (widget instanceof AreaTypeWidgetEnum<?>) {
            AreaTypeWidgetEnum<?> enumWidget = (AreaTypeWidgetEnum<?>) widget;
            WidgetComboBox enumCbb = new WidgetComboBox(fontRenderer, x, curY, 80, fontRenderer.FONT_HEIGHT + 1).setFixedOptions();
            enumCbb.setElements(getEnumNames(enumWidget.enumClass));
            enumCbb.setText(enumWidget.readAction.get().toString());
            addWidget(enumCbb);
            areaTypeValueWidgets.add(new ImmutablePair<AreaType.AreaTypeWidget, IGuiWidget>(widget, enumCbb));
            curY += fontRenderer.FONT_HEIGHT + 20;
        } else {
            throw new IllegalStateException("Invalid widget type: " + widget.getClass());
        }
    }
}
Also used : WidgetLabel(me.desht.pneumaticcraft.client.gui.widget.WidgetLabel) AreaTypeWidgetInteger(me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidgetInteger) WidgetTextFieldNumber(me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber) IGuiWidget(me.desht.pneumaticcraft.client.gui.widget.IGuiWidget) ArrayList(java.util.ArrayList) AreaType(me.desht.pneumaticcraft.common.progwidgets.area.AreaType) AreaTypeWidgetEnum(me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidgetEnum) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) AreaTypeWidget(me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidget) WidgetComboBox(me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)

Example 5 with WidgetLabel

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

the class GuiLogisticsBase method initGui.

@Override
public void initGui() {
    super.initGui();
    if (searchGui != null) {
        inventorySlots.getSlot(editingSlot).putStack(searchGui.getSearchStack());
        NetworkHandler.sendToServer(new PacketSetLogisticsFilterStack(logistics, searchGui.getSearchStack(), editingSlot));
        searchGui = null;
    }
    if (fluidSearchGui != null && fluidSearchGui.getFilter() != null) {
        FluidStack filter = new FluidStack(fluidSearchGui.getFilter(), 1000);
        logistics.setFilter(editingSlot, filter);
        NetworkHandler.sendToServer(new PacketSetLogisticsFluidFilterStack(logistics, filter, editingSlot));
        fluidSearchGui = null;
    }
    String invisibleText = I18n.format("gui.logistic_frame.invisible");
    addWidget(invisible = new GuiCheckBox(9, guiLeft + xSize - 15 - fontRenderer.getStringWidth(invisibleText), guiTop + 7, 0xFF404040, invisibleText));
    invisible.setTooltip(Arrays.asList(WordUtils.wrap(I18n.format("gui.logistic_frame.invisible.tooltip"), 40).split(System.getProperty("line.separator"))));
    addWidget(new WidgetLabel(guiLeft + 8, guiTop + 18, I18n.format(String.format("gui.%s.filters", SemiBlockManager.getKeyForSemiBlock(logistics)))));
    addWidget(new WidgetLabel(guiLeft + 8, guiTop + 90, I18n.format("gui.logistic_frame.liquid")));
    for (int i = 0; i < 9; i++) {
        addWidget(new WidgetFluidStack(i, guiLeft + i * 18 + 8, guiTop + 101, logistics.getTankFilter(i)));
    }
    addInfoTab(I18n.format("gui.tab.info." + SemiBlockManager.getKeyForSemiBlock(logistics)));
}
Also used : WidgetLabel(me.desht.pneumaticcraft.client.gui.widget.WidgetLabel) PacketSetLogisticsFilterStack(me.desht.pneumaticcraft.common.network.PacketSetLogisticsFilterStack) PacketSetLogisticsFluidFilterStack(me.desht.pneumaticcraft.common.network.PacketSetLogisticsFluidFilterStack) WidgetFluidStack(me.desht.pneumaticcraft.client.gui.widget.WidgetFluidStack) FluidStack(net.minecraftforge.fluids.FluidStack) WidgetFluidStack(me.desht.pneumaticcraft.client.gui.widget.WidgetFluidStack) GuiCheckBox(me.desht.pneumaticcraft.client.gui.widget.GuiCheckBox)

Aggregations

WidgetLabel (me.desht.pneumaticcraft.client.gui.widget.WidgetLabel)5 WidgetTextFieldNumber (me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber)3 WidgetComboBox (me.desht.pneumaticcraft.client.gui.widget.WidgetComboBox)2 ArrayList (java.util.ArrayList)1 GuiCheckBox (me.desht.pneumaticcraft.client.gui.widget.GuiCheckBox)1 IGuiWidget (me.desht.pneumaticcraft.client.gui.widget.IGuiWidget)1 WidgetFluidFilter (me.desht.pneumaticcraft.client.gui.widget.WidgetFluidFilter)1 WidgetFluidStack (me.desht.pneumaticcraft.client.gui.widget.WidgetFluidStack)1 WidgetTank (me.desht.pneumaticcraft.client.gui.widget.WidgetTank)1 ContainerAmadronAddTrade (me.desht.pneumaticcraft.common.inventory.ContainerAmadronAddTrade)1 PacketSetLogisticsFilterStack (me.desht.pneumaticcraft.common.network.PacketSetLogisticsFilterStack)1 PacketSetLogisticsFluidFilterStack (me.desht.pneumaticcraft.common.network.PacketSetLogisticsFluidFilterStack)1 AreaType (me.desht.pneumaticcraft.common.progwidgets.area.AreaType)1 AreaTypeWidget (me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidget)1 AreaTypeWidgetEnum (me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidgetEnum)1 AreaTypeWidgetInteger (me.desht.pneumaticcraft.common.progwidgets.area.AreaType.AreaTypeWidgetInteger)1 GuiButton (net.minecraft.client.gui.GuiButton)1 ItemStack (net.minecraft.item.ItemStack)1 Fluid (net.minecraftforge.fluids.Fluid)1 FluidStack (net.minecraftforge.fluids.FluidStack)1