Search in sources :

Example 1 with SlotItemHandler

use of net.minecraftforge.items.SlotItemHandler in project Binnie by ForestryMC.

the class ContainerFrameHousing method setupContainer.

@Override
protected void setupContainer() {
    offset = -21;
    addPlayerInventory();
    addSlotToContainer(new SlotItemHandler(inv, 0, 80, 37));
}
Also used : SlotItemHandler(net.minecraftforge.items.SlotItemHandler)

Example 2 with SlotItemHandler

use of net.minecraftforge.items.SlotItemHandler in project Binnie by ForestryMC.

the class ContainerMutator method setupContainer.

@Override
protected void setupContainer() {
    addPlayerInventory();
    addSlotToContainer(new SlotItemHandler(inv, 0, 81, 29));
}
Also used : SlotItemHandler(net.minecraftforge.items.SlotItemHandler)

Example 3 with SlotItemHandler

use of net.minecraftforge.items.SlotItemHandler in project Binnie by ForestryMC.

the class ContainerHatchery method setupContainer.

@Override
protected void setupContainer() {
    offset = -21;
    addPlayerInventory();
    for (int i = 0; i < 5; i++) {
        addSlotToContainer(new SlotItemHandler(inv, i, 44 + i * 18, 37));
    }
}
Also used : SlotItemHandler(net.minecraftforge.items.SlotItemHandler)

Example 4 with SlotItemHandler

use of net.minecraftforge.items.SlotItemHandler 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)

Example 5 with SlotItemHandler

use of net.minecraftforge.items.SlotItemHandler in project Binnie by ForestryMC.

the class ContainerStimulator method setupContainer.

@Override
protected void setupContainer() {
    offset = -21;
    addPlayerInventory();
    title = "Stimulator";
    addSlotToContainer(new SlotItemHandler(inv, 0, 44, 37));
}
Also used : SlotItemHandler(net.minecraftforge.items.SlotItemHandler)

Aggregations

SlotItemHandler (net.minecraftforge.items.SlotItemHandler)7 FluidTankList (gregtech.api.capability.impl.FluidTankList)1 Widget (gregtech.api.gui.Widget)1 SlotWidget (gregtech.api.gui.widgets.SlotWidget)1 TankWidget (gregtech.api.gui.widgets.TankWidget)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 IItemHandler (net.minecraftforge.items.IItemHandler)1