Search in sources :

Example 1 with ToggleButtonWidget

use of gregtech.api.gui.widgets.ToggleButtonWidget in project GregTech by GregTechCE.

the class SimpleMachineMetaTileEntity method createGuiTemplate.

protected ModularUI.Builder createGuiTemplate(EntityPlayer player) {
    ModularUI.Builder builder = workable.recipeMap.createUITemplate(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids).widget(new LabelWidget(7, 5, getMetaFullName())).widget(new DischargerSlotWidget(chargerInventory, 0, 79, 62).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.CHARGER_OVERLAY)).widget(new ImageWidget(79, 42, 18, 18, GuiTextures.INDICATOR_NO_ENERGY).setPredicate(workable::isHasNotEnoughEnergy)).bindPlayerInventory(player.inventory);
    int leftButtonStartX = 7;
    int rightButtonStartX = 176 - 7 - 45;
    if (workable.recipeMap instanceof RecipeMapWithConfigButton) {
        leftButtonStartX += ((RecipeMapWithConfigButton) workable.recipeMap).getLeftButtonOffset();
        rightButtonStartX -= ((RecipeMapWithConfigButton) workable.recipeMap).getRightButtonOffset();
    }
    if (exportItems.getSlots() > 0) {
        builder.widget(new ToggleButtonWidget(leftButtonStartX, 62, 18, 18, GuiTextures.BUTTON_ITEM_OUTPUT, this::isAutoOutputItems, this::setAutoOutputItems).setTooltipText("gregtech.gui.item_auto_output.tooltip"));
        leftButtonStartX += 18;
    }
    if (exportFluids.getTanks() > 0) {
        builder.widget(new ToggleButtonWidget(leftButtonStartX, 62, 18, 18, GuiTextures.BUTTON_FLUID_OUTPUT, this::isAutoOutputFluids, this::setAutoOutputFluids).setTooltipText("gregtech.gui.fluid_auto_output.tooltip"));
        leftButtonStartX += 18;
    }
    builder.widget(new CycleButtonWidget(leftButtonStartX, 62, 18, 18, workable.getAvailableOverclockingTiers(), workable::getOverclockTier, workable::setOverclockTier).setTooltipHoverString("gregtech.gui.overclock.description").setButtonTexture(GuiTextures.BUTTON_OVERCLOCK));
    return builder;
}
Also used : ToggleButtonWidget(gregtech.api.gui.widgets.ToggleButtonWidget) ModularUI(gregtech.api.gui.ModularUI) DischargerSlotWidget(gregtech.api.gui.widgets.DischargerSlotWidget) LabelWidget(gregtech.api.gui.widgets.LabelWidget) CycleButtonWidget(gregtech.api.gui.widgets.CycleButtonWidget) ImageWidget(gregtech.api.gui.widgets.ImageWidget)

Example 2 with ToggleButtonWidget

use of gregtech.api.gui.widgets.ToggleButtonWidget in project GregTech by GregTechCE.

the class ItemFilterWrapper method initUI.

public void initUI(int y, Consumer<Widget> widgetGroup) {
    ServerWidgetGroup blacklistButton = new ServerWidgetGroup(() -> getItemFilter() != null);
    blacklistButton.addWidget(new ToggleButtonWidget(146, y, 20, 20, GuiTextures.BUTTON_BLACKLIST, this::isBlacklistFilter, this::setBlacklistFilter).setTooltipText("cover.filter.blacklist"));
    widgetGroup.accept(blacklistButton);
    widgetGroup.accept(new WidgetGroupItemFilter(y, this::getItemFilter));
}
Also used : ToggleButtonWidget(gregtech.api.gui.widgets.ToggleButtonWidget) ServerWidgetGroup(gregtech.api.gui.widgets.ServerWidgetGroup)

Aggregations

ToggleButtonWidget (gregtech.api.gui.widgets.ToggleButtonWidget)2 ModularUI (gregtech.api.gui.ModularUI)1 CycleButtonWidget (gregtech.api.gui.widgets.CycleButtonWidget)1 DischargerSlotWidget (gregtech.api.gui.widgets.DischargerSlotWidget)1 ImageWidget (gregtech.api.gui.widgets.ImageWidget)1 LabelWidget (gregtech.api.gui.widgets.LabelWidget)1 ServerWidgetGroup (gregtech.api.gui.widgets.ServerWidgetGroup)1