Search in sources :

Example 1 with ProgressWidget

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

the class RecipeMap method createUITemplate.

// this DOES NOT include machine control widgets or binds player inventory
public ModularUI.Builder createUITemplate(DoubleSupplier progressSupplier, IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids) {
    ModularUI.Builder builder = ModularUI.defaultBuilder();
    builder.widget(new ProgressWidget(progressSupplier, 77, 22, 21, 20, progressBarTexture, moveType));
    addInventorySlotGroup(builder, importItems, importFluids, false);
    addInventorySlotGroup(builder, exportItems, exportFluids, true);
    return builder;
}
Also used : ModularUI(gregtech.api.gui.ModularUI) ProgressWidget(gregtech.api.gui.widgets.ProgressWidget)

Example 2 with ProgressWidget

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

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