Search in sources :

Example 1 with TankWidget

use of gregtech.api.gui.widgets.TankWidget 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 2 with TankWidget

use of gregtech.api.gui.widgets.TankWidget 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 3 with TankWidget

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

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

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

the class RecipeMapCategory method setRecipe.

@Override
public void setRecipe(IRecipeLayout recipeLayout, GTRecipeWrapper recipeWrapper, IIngredients ingredients) {
    IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks();
    IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks();
    for (Widget uiWidget : modularUI.guiWidgets.values()) {
        if (uiWidget instanceof SlotWidget) {
            SlotWidget slotWidget = (SlotWidget) uiWidget;
            if (!(slotWidget.getHandle() instanceof SlotItemHandler)) {
                continue;
            }
            SlotItemHandler handle = (SlotItemHandler) slotWidget.getHandle();
            if (handle.getItemHandler() == importItems) {
                // this is input item stack slot widget, so add it to item group
                itemStackGroup.init(handle.getSlotIndex(), true, slotWidget.getPosition().x, slotWidget.getPosition().y);
            } else if (handle.getItemHandler() == exportItems) {
                // this is output item stack slot widget, so add it to item group
                itemStackGroup.init(importItems.getSlots() + handle.getSlotIndex(), false, slotWidget.getPosition().x, slotWidget.getPosition().y);
            }
        } else if (uiWidget instanceof TankWidget) {
            TankWidget tankWidget = (TankWidget) uiWidget;
            if (importFluids.getFluidTanks().contains(tankWidget.fluidTank)) {
                int importIndex = importFluids.getFluidTanks().indexOf(tankWidget.fluidTank);
                List<List<FluidStack>> inputsList = ingredients.getInputs(FluidStack.class);
                int fluidAmount = 0;
                if (inputsList.size() > importIndex && !inputsList.get(importIndex).isEmpty())
                    fluidAmount = inputsList.get(importIndex).get(0).amount;
                // this is input tank widget, so add it to fluid group
                fluidStackGroup.init(importIndex, true, tankWidget.getPosition().x + tankWidget.fluidRenderOffset, tankWidget.getPosition().y + tankWidget.fluidRenderOffset, tankWidget.getSize().width - (2 * tankWidget.fluidRenderOffset), tankWidget.getSize().height - (2 * tankWidget.fluidRenderOffset), fluidAmount, false, null);
            } else if (exportFluids.getFluidTanks().contains(tankWidget.fluidTank)) {
                int exportIndex = exportFluids.getFluidTanks().indexOf(tankWidget.fluidTank);
                List<List<FluidStack>> inputsList = ingredients.getOutputs(FluidStack.class);
                int fluidAmount = 0;
                if (inputsList.size() > exportIndex && !inputsList.get(exportIndex).isEmpty())
                    fluidAmount = inputsList.get(exportIndex).get(0).amount;
                // this is output tank widget, so add it to fluid group
                fluidStackGroup.init(importFluids.getFluidTanks().size() + exportIndex, false, tankWidget.getPosition().x + tankWidget.fluidRenderOffset, tankWidget.getPosition().y + tankWidget.fluidRenderOffset, tankWidget.getSize().width - (2 * tankWidget.fluidRenderOffset), tankWidget.getSize().height - (2 * tankWidget.fluidRenderOffset), fluidAmount, false, null);
            }
        }
    }
    itemStackGroup.addTooltipCallback(recipeWrapper::addTooltip);
    fluidStackGroup.addTooltipCallback(recipeWrapper::addTooltip);
    itemStackGroup.set(ingredients);
    fluidStackGroup.set(ingredients);
}
Also used : TankWidget(gregtech.api.gui.widgets.TankWidget) SlotWidget(gregtech.api.gui.widgets.SlotWidget) FluidStack(net.minecraftforge.fluids.FluidStack) IGuiFluidStackGroup(mezz.jei.api.gui.IGuiFluidStackGroup) IGuiItemStackGroup(mezz.jei.api.gui.IGuiItemStackGroup) Widget(gregtech.api.gui.Widget) TankWidget(gregtech.api.gui.widgets.TankWidget) SlotWidget(gregtech.api.gui.widgets.SlotWidget) FluidTankList(gregtech.api.capability.impl.FluidTankList) List(java.util.List) SlotItemHandler(net.minecraftforge.items.SlotItemHandler)

Aggregations

SlotWidget (gregtech.api.gui.widgets.SlotWidget)5 TankWidget (gregtech.api.gui.widgets.TankWidget)5 Builder (gregtech.api.gui.ModularUI.Builder)4 FluidContainerSlotWidget (gregtech.api.gui.widgets.FluidContainerSlotWidget)4 ImageWidget (gregtech.api.gui.widgets.ImageWidget)4 FluidTankList (gregtech.api.capability.impl.FluidTankList)1 Widget (gregtech.api.gui.Widget)1 List (java.util.List)1 IGuiFluidStackGroup (mezz.jei.api.gui.IGuiFluidStackGroup)1 IGuiItemStackGroup (mezz.jei.api.gui.IGuiItemStackGroup)1 FluidStack (net.minecraftforge.fluids.FluidStack)1 SlotItemHandler (net.minecraftforge.items.SlotItemHandler)1