Search in sources :

Example 1 with Builder

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

the class RecipeMapGroupOutput method createUITemplate.

@Override
public 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);
    BooleanWrapper booleanWrapper = new BooleanWrapper();
    ServerWidgetGroup itemOutputGroup = createItemOutputWidgetGroup(exportItems, new ServerWidgetGroup(() -> !booleanWrapper.getCurrentMode()));
    ServerWidgetGroup fluidOutputGroup = createFluidOutputWidgetGroup(exportFluids, new ServerWidgetGroup(booleanWrapper::getCurrentMode));
    builder.widget(itemOutputGroup).widget(fluidOutputGroup);
    ToggleButtonWidget buttonWidget = new ToggleButtonWidget(176 - 7 - 54, 62, 18, 18, GuiTextures.BUTTON_SWITCH_VIEW, booleanWrapper::getCurrentMode, booleanWrapper::setCurrentMode).setTooltipText("gregtech.gui.toggle_view");
    builder.widget(buttonWidget);
    return builder;
}
Also used : ModularUI(gregtech.api.gui.ModularUI) Builder(gregtech.api.gui.ModularUI.Builder)

Example 2 with Builder

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

the class MetaTileEntityChest method createUI.

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
    Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, Math.max(176, 14 + rowSize * 18), 18 + 18 * amountOfRows + 94).label(5, 5, getMetaFullName());
    builder.widget(new SortingButtonWidget(111, 4, 60, 10, "gregtech.gui.sort", (info) -> sortInventorySlotContents(inventory)));
    for (int y = 0; y < amountOfRows; y++) {
        for (int x = 0; x < rowSize; x++) {
            int index = y * rowSize + x;
            builder.slot(inventory, index, 7 + x * 18, 18 + y * 18, GuiTextures.SLOT);
        }
    }
    int startX = (Math.max(176, 14 + rowSize * 18) - 162) / 2;
    builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, startX, 18 + 18 * amountOfRows + 12);
    if (!getWorld().isRemote) {
        builder.bindOpenListener(() -> onContainerOpen(entityPlayer));
        builder.bindCloseListener(() -> onContainerClose(entityPlayer));
    }
    return builder.build(getHolder(), entityPlayer);
}
Also used : Matrix4(codechicken.lib.vec.Matrix4) ModHandler(gregtech.api.recipes.ModHandler) Textures(gregtech.api.render.Textures) IFastRenderMetaTileEntity(gregtech.api.metatileentity.IFastRenderMetaTileEntity) SolidMaterial(gregtech.api.unification.material.type.SolidMaterial) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) SortingButtonWidget(gregtech.api.gui.widgets.SortingButtonWidget) ArrayList(java.util.ArrayList) I18n(net.minecraft.client.resources.I18n) ItemStack(net.minecraft.item.ItemStack) ItemHandlerHelper(net.minecraftforge.items.ItemHandlerHelper) Pair(org.apache.commons.lang3.tuple.Pair) Side(net.minecraftforge.fml.relauncher.Side) IItemHandlerModifiable(net.minecraftforge.items.IItemHandlerModifiable) NonNullList(net.minecraft.util.NonNullList) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) SoundCategory(net.minecraft.util.SoundCategory) Nullable(javax.annotation.Nullable) ColourRGBA(codechicken.lib.colour.ColourRGBA) MetaTileEntityHolder(gregtech.api.metatileentity.MetaTileEntityHolder) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) CCRenderState(codechicken.lib.render.CCRenderState) SoundEvents(net.minecraft.init.SoundEvents) World(net.minecraft.world.World) GTUtility.convertOpaqueRGBA_CLtoRGB(gregtech.api.util.GTUtility.convertOpaqueRGBA_CLtoRGB) BlockPos(net.minecraft.util.math.BlockPos) GuiTextures(gregtech.api.gui.GuiTextures) List(java.util.List) ItemStackHandler(net.minecraftforge.items.ItemStackHandler) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ResourceLocation(net.minecraft.util.ResourceLocation) ModularUI(gregtech.api.gui.ModularUI) Builder(gregtech.api.gui.ModularUI.Builder) GTUtility(gregtech.api.util.GTUtility) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier) PacketBuffer(net.minecraft.network.PacketBuffer) IndexedCuboid6(codechicken.lib.raytracer.IndexedCuboid6) Cuboid6(codechicken.lib.vec.Cuboid6) Builder(gregtech.api.gui.ModularUI.Builder) SortingButtonWidget(gregtech.api.gui.widgets.SortingButtonWidget)

Example 3 with Builder

use of gregtech.api.gui.ModularUI.Builder 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 4 with Builder

use of gregtech.api.gui.ModularUI.Builder 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 5 with Builder

use of gregtech.api.gui.ModularUI.Builder 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)

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