Search in sources :

Example 11 with Builder

use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.

the class MetaTileEntityCharger 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.CHARGER_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 12 with Builder

use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.

the class SimpleGeneratorMetaTileEntity method createGuiTemplate.

protected ModularUI.Builder createGuiTemplate(EntityPlayer player) {
    Builder builder = ModularUI.defaultBuilder();
    builder.image(7, 16, 81, 55, GuiTextures.DISPLAY);
    TankWidget tankWidget = new TankWidget(importFluids.getTankAt(0), 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, true).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(player.inventory);
}
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 13 with Builder

use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.

the class MetaTileEntityWorkbench method createUI.

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
    Builder builder = ModularUI.builder(GuiTextures.BORDERED_BACKGROUND, 176, 221).bindPlayerInventory(entityPlayer.inventory, 140);
    builder.label(5, 5, getMetaFullName());
    TabGroup tabGroup = new TabGroup(TabLocation.HORIZONTAL_TOP_LEFT, Position.ORIGIN);
    tabGroup.addTab(new ItemTabInfo("gregtech.machine.workbench.tab.workbench", new ItemStack(Blocks.CRAFTING_TABLE)), createWorkbenchTab());
    tabGroup.addTab(new ItemTabInfo("gregtech.machine.workbench.tab.item_list", new ItemStack(Blocks.CHEST)), createItemListTab());
    builder.widget(tabGroup);
    return builder.build(getHolder(), entityPlayer);
}
Also used : Builder(gregtech.api.gui.ModularUI.Builder) ItemTabInfo(gregtech.api.gui.widgets.tab.ItemTabInfo) ItemStack(net.minecraft.item.ItemStack)

Aggregations

Builder (gregtech.api.gui.ModularUI.Builder)13 SlotWidget (gregtech.api.gui.widgets.SlotWidget)10 ImageWidget (gregtech.api.gui.widgets.ImageWidget)5 FluidContainerSlotWidget (gregtech.api.gui.widgets.FluidContainerSlotWidget)4 TankWidget (gregtech.api.gui.widgets.TankWidget)4 ModularUI (gregtech.api.gui.ModularUI)3 ItemStack (net.minecraft.item.ItemStack)3 CCRenderState (codechicken.lib.render.CCRenderState)2 IVertexOperation (codechicken.lib.render.pipeline.IVertexOperation)2 Matrix4 (codechicken.lib.vec.Matrix4)2 GuiTextures (gregtech.api.gui.GuiTextures)2 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)2 MetaTileEntityHolder (gregtech.api.metatileentity.MetaTileEntityHolder)2 Textures (gregtech.api.render.Textures)2 List (java.util.List)2 Nullable (javax.annotation.Nullable)2 I18n (net.minecraft.client.resources.I18n)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 PacketBuffer (net.minecraft.network.PacketBuffer)2