Search in sources :

Example 1 with ImageWidget

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

the class SimpleMachineMetaTileEntity method createGuiTemplate.

protected ModularUI.Builder createGuiTemplate(EntityPlayer player) {
    ModularUI.Builder builder = workable.recipeMap.createUITemplate(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids).widget(new LabelWidget(7, 5, getMetaFullName())).widget(new DischargerSlotWidget(chargerInventory, 0, 79, 62).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.CHARGER_OVERLAY)).widget(new ImageWidget(79, 42, 18, 18, GuiTextures.INDICATOR_NO_ENERGY).setPredicate(workable::isHasNotEnoughEnergy)).bindPlayerInventory(player.inventory);
    int leftButtonStartX = 7;
    int rightButtonStartX = 176 - 7 - 45;
    if (workable.recipeMap instanceof RecipeMapWithConfigButton) {
        leftButtonStartX += ((RecipeMapWithConfigButton) workable.recipeMap).getLeftButtonOffset();
        rightButtonStartX -= ((RecipeMapWithConfigButton) workable.recipeMap).getRightButtonOffset();
    }
    if (exportItems.getSlots() > 0) {
        builder.widget(new ToggleButtonWidget(leftButtonStartX, 62, 18, 18, GuiTextures.BUTTON_ITEM_OUTPUT, this::isAutoOutputItems, this::setAutoOutputItems).setTooltipText("gregtech.gui.item_auto_output.tooltip"));
        leftButtonStartX += 18;
    }
    if (exportFluids.getTanks() > 0) {
        builder.widget(new ToggleButtonWidget(leftButtonStartX, 62, 18, 18, GuiTextures.BUTTON_FLUID_OUTPUT, this::isAutoOutputFluids, this::setAutoOutputFluids).setTooltipText("gregtech.gui.fluid_auto_output.tooltip"));
        leftButtonStartX += 18;
    }
    builder.widget(new CycleButtonWidget(leftButtonStartX, 62, 18, 18, workable.getAvailableOverclockingTiers(), workable::getOverclockTier, workable::setOverclockTier).setTooltipHoverString("gregtech.gui.overclock.description").setButtonTexture(GuiTextures.BUTTON_OVERCLOCK));
    return builder;
}
Also used : ToggleButtonWidget(gregtech.api.gui.widgets.ToggleButtonWidget) ModularUI(gregtech.api.gui.ModularUI) DischargerSlotWidget(gregtech.api.gui.widgets.DischargerSlotWidget) LabelWidget(gregtech.api.gui.widgets.LabelWidget) CycleButtonWidget(gregtech.api.gui.widgets.CycleButtonWidget) ImageWidget(gregtech.api.gui.widgets.ImageWidget)

Example 2 with ImageWidget

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

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

the class MetaTileEntityPump method createUI.

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
    Builder builder = ModularUI.defaultBuilder();
    builder.image(7, 16, 81, 55, GuiTextures.DISPLAY);
    TankWidget tankWidget = new TankWidget(exportFluids.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(importItems, 0, 90, 17, false).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.IN_SLOT_OVERLAY)).widget(new ImageWidget(91, 36, 14, 15, GuiTextures.TANK_ICON)).widget(new SlotWidget(exportItems, 0, 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 4 with ImageWidget

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

the class MetaTileEntityFluidHatch method createTankUI.

public ModularUI.Builder createTankUI(IFluidTank fluidTank, IItemHandlerModifiable containerInventory, String title, 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, title).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);
}
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 ImageWidget

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

the class MetaTileEntityItemCollector method createUI.

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
    int rowSize = (int) Math.sqrt(exportItems.getSlots());
    Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 45 + rowSize * 18 + 105 + 82).label(10, 5, getMetaFullName());
    builder.widget(new ClickButtonWidget(10, 20, 20, 20, "-1", data -> adjustSuckingRange(-1)));
    builder.widget(new ClickButtonWidget(146, 20, 20, 20, "+1", data -> adjustSuckingRange(+1)));
    builder.widget(new ImageWidget(30, 20, 116, 20, GuiTextures.DISPLAY));
    builder.widget(new SimpleTextWidget(88, 30, "gregtech.machine.item_collector.gui.collect_range", 0xFFFFFF, () -> Integer.toString(itemSuckingRange)));
    for (int y = 0; y < rowSize; y++) {
        for (int x = 0; x < rowSize; x++) {
            int index = y * rowSize + x;
            builder.widget(new SlotWidget(exportItems, index, 89 - rowSize * 9 + x * 18, 45 + y * 18, true, false).setBackgroundTexture(GuiTextures.SLOT));
        }
    }
    this.itemFilter.initUI(45 + rowSize * 18 + 5, builder::widget);
    builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 45 + rowSize * 18 + 105);
    return builder.build(getHolder(), entityPlayer);
}
Also used : ClickButtonWidget(gregtech.api.gui.widgets.ClickButtonWidget) Matrix4(codechicken.lib.vec.Matrix4) SimpleTextWidget(gregtech.api.gui.widgets.SimpleTextWidget) Textures(gregtech.api.render.Textures) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) ClickButtonWidget(gregtech.api.gui.widgets.ClickButtonWidget) ImageWidget(gregtech.api.gui.widgets.ImageWidget) I18n(net.minecraft.client.resources.I18n) ItemStack(net.minecraft.item.ItemStack) ItemHandlerHelper(net.minecraftforge.items.ItemHandlerHelper) Side(net.minecraftforge.fml.relauncher.Side) IItemHandlerModifiable(net.minecraftforge.items.IItemHandlerModifiable) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Nullable(javax.annotation.Nullable) SlotWidget(gregtech.api.gui.widgets.SlotWidget) MetaTileEntityHolder(gregtech.api.metatileentity.MetaTileEntityHolder) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) EntityItem(net.minecraft.entity.item.EntityItem) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) CCRenderState(codechicken.lib.render.CCRenderState) World(net.minecraft.world.World) ItemFilterContainer(gregtech.common.covers.filter.ItemFilterContainer) EnumFacing(net.minecraft.util.EnumFacing) BlockPos(net.minecraft.util.math.BlockPos) GuiTextures(gregtech.api.gui.GuiTextures) Capability(net.minecraftforge.common.capabilities.Capability) SimpleOverlayRenderer(gregtech.api.render.SimpleOverlayRenderer) List(java.util.List) GTValues(gregtech.api.GTValues) TieredMetaTileEntity(gregtech.api.metatileentity.TieredMetaTileEntity) ItemStackHandler(net.minecraftforge.items.ItemStackHandler) EntityPlayer(net.minecraft.entity.player.EntityPlayer) MathHelper(net.minecraft.util.math.MathHelper) ResourceLocation(net.minecraft.util.ResourceLocation) ModularUI(gregtech.api.gui.ModularUI) Builder(gregtech.api.gui.ModularUI.Builder) PacketBuffer(net.minecraft.network.PacketBuffer) SlotWidget(gregtech.api.gui.widgets.SlotWidget) Builder(gregtech.api.gui.ModularUI.Builder) ImageWidget(gregtech.api.gui.widgets.ImageWidget) SimpleTextWidget(gregtech.api.gui.widgets.SimpleTextWidget)

Aggregations

ImageWidget (gregtech.api.gui.widgets.ImageWidget)6 Builder (gregtech.api.gui.ModularUI.Builder)5 SlotWidget (gregtech.api.gui.widgets.SlotWidget)5 FluidContainerSlotWidget (gregtech.api.gui.widgets.FluidContainerSlotWidget)4 TankWidget (gregtech.api.gui.widgets.TankWidget)4 ModularUI (gregtech.api.gui.ModularUI)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 GuiTextures (gregtech.api.gui.GuiTextures)1 ClickButtonWidget (gregtech.api.gui.widgets.ClickButtonWidget)1 CycleButtonWidget (gregtech.api.gui.widgets.CycleButtonWidget)1 DischargerSlotWidget (gregtech.api.gui.widgets.DischargerSlotWidget)1 LabelWidget (gregtech.api.gui.widgets.LabelWidget)1 SimpleTextWidget (gregtech.api.gui.widgets.SimpleTextWidget)1 ToggleButtonWidget (gregtech.api.gui.widgets.ToggleButtonWidget)1 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 MetaTileEntityHolder (gregtech.api.metatileentity.MetaTileEntityHolder)1 TieredMetaTileEntity (gregtech.api.metatileentity.TieredMetaTileEntity)1