Search in sources :

Example 1 with ServerWidgetGroup

use of gregtech.api.gui.widgets.ServerWidgetGroup 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)

Example 2 with ServerWidgetGroup

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

the class MetaTileEntityLockedSafe method createUI.

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
    DoubleSupplier supplier = () -> 0.2 + (unlockProgress / (MAX_UNLOCK_PROGRESS * 1.0)) * 0.8;
    ModularUI.Builder builder = ModularUI.defaultBuilder().widget(new ProgressWidget(supplier, 5, 5, 166, 74, GuiTextures.PROGRESS_BAR_UNLOCK, MoveType.VERTICAL_INVERTED)).bindPlayerInventory(entityPlayer.inventory);
    ServerWidgetGroup lockedGroup = new ServerWidgetGroup(() -> !isSafeUnlocked && unlockProgress < 0);
    lockedGroup.addWidget(new LabelWidget(5, 20, "gregtech.machine.locked_safe.malfunctioning"));
    lockedGroup.addWidget(new LabelWidget(5, 30, "gregtech.machine.locked_safe.requirements"));
    lockedGroup.addWidget(new SlotWidget(unlockInventory, 0, 70, 40, false, true).setBackgroundTexture(GuiTextures.SLOT));
    lockedGroup.addWidget(new SlotWidget(unlockInventory, 1, 70 + 18, 40, false, true).setBackgroundTexture(GuiTextures.SLOT));
    lockedGroup.addWidget(new SlotWidget(unlockComponents, 0, 70, 58, false, false));
    lockedGroup.addWidget(new SlotWidget(unlockComponents, 1, 70 + 18, 58, false, false));
    ServerWidgetGroup unlockedGroup = new ServerWidgetGroup(() -> isSafeUnlocked);
    for (int row = 0; row < 3; row++) {
        for (int col = 0; col < 9; col++) {
            unlockedGroup.addWidget(new SlotWidget(safeLootInventory, col + row * 9, 8 + col * 18, 15 + row * 18, true, false));
        }
    }
    return builder.widget(unlockedGroup).widget(lockedGroup).build(getHolder(), entityPlayer);
}
Also used : SlotWidget(gregtech.api.gui.widgets.SlotWidget) ModularUI(gregtech.api.gui.ModularUI) DoubleSupplier(java.util.function.DoubleSupplier) ProgressWidget(gregtech.api.gui.widgets.ProgressWidget) ServerWidgetGroup(gregtech.api.gui.widgets.ServerWidgetGroup) LabelWidget(gregtech.api.gui.widgets.LabelWidget)

Aggregations

ServerWidgetGroup (gregtech.api.gui.widgets.ServerWidgetGroup)2 ModularUI (gregtech.api.gui.ModularUI)1 LabelWidget (gregtech.api.gui.widgets.LabelWidget)1 ProgressWidget (gregtech.api.gui.widgets.ProgressWidget)1 SlotWidget (gregtech.api.gui.widgets.SlotWidget)1 ToggleButtonWidget (gregtech.api.gui.widgets.ToggleButtonWidget)1 DoubleSupplier (java.util.function.DoubleSupplier)1