Search in sources :

Example 1 with SlotWidget

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

the class MetaTileEntityQuantumChest method createUI.

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
    Builder builder = ModularUI.defaultBuilder();
    builder.image(7, 16, 81, 55, GuiTextures.DISPLAY);
    builder.widget(new AdvancedTextWidget(11, 20, this::addDisplayInformation, 0xFFFFFF));
    return builder.label(6, 6, getMetaFullName()).widget(new SlotWidget(importItems, 0, 90, 17, true, true).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.IN_SLOT_OVERLAY)).widget(new SlotWidget(exportItems, 0, 90, 54, true, false).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)).bindPlayerInventory(entityPlayer.inventory).build(getHolder(), entityPlayer);
}
Also used : SlotWidget(gregtech.api.gui.widgets.SlotWidget) Builder(gregtech.api.gui.ModularUI.Builder) AdvancedTextWidget(gregtech.api.gui.widgets.AdvancedTextWidget)

Example 2 with SlotWidget

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

the class MetaTileEntityQuantumTank method createUI.

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
    Builder builder = ModularUI.defaultBuilder();
    builder.image(7, 16, 81, 55, GuiTextures.DISPLAY);
    TankWidget tankWidget = new TankWidget(fluidTank, 69, 52, 18, 18).setHideTooltip(true).setAlwaysShowFull(true);
    builder.widget(tankWidget);
    builder.label(11, 20, "gregtech.gui.fluid_amount", 0xFFFFFF);
    builder.dynamicLabel(11, 30, tankWidget::getFormattedFluidAmount, 0xFFFFFF);
    builder.dynamicLabel(11, 40, tankWidget::getFluidLocalizedName, 0xFFFFFF);
    return builder.label(6, 6, getMetaFullName()).widget(new FluidContainerSlotWidget(containerInventory, 0, 90, 17, false).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.IN_SLOT_OVERLAY)).widget(new ImageWidget(91, 36, 14, 15, GuiTextures.TANK_ICON)).widget(new SlotWidget(containerInventory, 1, 90, 54, true, false).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)).bindPlayerInventory(entityPlayer.inventory).build(getHolder(), entityPlayer);
}
Also used : TankWidget(gregtech.api.gui.widgets.TankWidget) SlotWidget(gregtech.api.gui.widgets.SlotWidget) FluidContainerSlotWidget(gregtech.api.gui.widgets.FluidContainerSlotWidget) Builder(gregtech.api.gui.ModularUI.Builder) FluidContainerSlotWidget(gregtech.api.gui.widgets.FluidContainerSlotWidget) ImageWidget(gregtech.api.gui.widgets.ImageWidget)

Example 3 with SlotWidget

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

the class MetaTileEntityBatteryBuffer method createUI.

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
    int rowSize = (int) Math.sqrt(inventorySize);
    Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 18 + 18 * rowSize + 94).label(10, 5, getMetaFullName());
    for (int y = 0; y < rowSize; y++) {
        for (int x = 0; x < rowSize; x++) {
            int index = y * rowSize + x;
            builder.widget(new SlotWidget(importItems, index, 89 - rowSize * 9 + x * 18, 18 + y * 18, true, true).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.BATTERY_OVERLAY));
        }
    }
    builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12);
    return builder.build(getHolder(), entityPlayer);
}
Also used : SlotWidget(gregtech.api.gui.widgets.SlotWidget) Builder(gregtech.api.gui.ModularUI.Builder)

Example 4 with SlotWidget

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

Example 5 with SlotWidget

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

the class MetaTileEntityItemBus method createUITemplate.

private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize, int xOffset) {
    Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176 + xOffset * 2, 18 + 18 * rowSize + 94).label(10, 5, getMetaFullName());
    for (int y = 0; y < rowSize; y++) {
        for (int x = 0; x < rowSize; x++) {
            int index = y * rowSize + x;
            builder.widget(new SlotWidget(isExportHatch ? exportItems : importItems, index, (88 - rowSize * 9 + x * 18) + xOffset, 18 + y * 18, true, !isExportHatch).setBackgroundTexture(GuiTextures.SLOT));
        }
    }
    return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, 7 + xOffset, 18 + 18 * rowSize + 12);
}
Also used : SlotWidget(gregtech.api.gui.widgets.SlotWidget) Builder(gregtech.api.gui.ModularUI.Builder)

Aggregations

SlotWidget (gregtech.api.gui.widgets.SlotWidget)13 Builder (gregtech.api.gui.ModularUI.Builder)10 ImageWidget (gregtech.api.gui.widgets.ImageWidget)5 TankWidget (gregtech.api.gui.widgets.TankWidget)5 FluidContainerSlotWidget (gregtech.api.gui.widgets.FluidContainerSlotWidget)4 ModularUI (gregtech.api.gui.ModularUI)2 LabelWidget (gregtech.api.gui.widgets.LabelWidget)2 List (java.util.List)2 CCRenderState (codechicken.lib.render.CCRenderState)1 IVertexOperation (codechicken.lib.render.pipeline.IVertexOperation)1 Matrix4 (codechicken.lib.vec.Matrix4)1 GTValues (gregtech.api.GTValues)1 FluidTankList (gregtech.api.capability.impl.FluidTankList)1 GuiTextures (gregtech.api.gui.GuiTextures)1 Widget (gregtech.api.gui.Widget)1 AdvancedTextWidget (gregtech.api.gui.widgets.AdvancedTextWidget)1 ClickButtonWidget (gregtech.api.gui.widgets.ClickButtonWidget)1 ProgressWidget (gregtech.api.gui.widgets.ProgressWidget)1 ServerWidgetGroup (gregtech.api.gui.widgets.ServerWidgetGroup)1 SimpleTextWidget (gregtech.api.gui.widgets.SimpleTextWidget)1