Search in sources :

Example 6 with OrderStack

use of com.glodblock.github.nei.object.OrderStack in project AE2FluidCraft-Rework by GlodBlock.

the class GregTech6RecipeExtractor method getInputIngredients.

@Override
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
    this.removeMachine(rawInputs);
    List<PositionedStack> compressed = compress(rawInputs);
    List<OrderStack<?>> tmp = new LinkedList<>();
    for (int i = 0; i < compressed.size(); i++) {
        if (compressed.get(i) == null)
            continue;
        ItemStack item = compressed.get(i).items[0];
        OrderStack<?> stack;
        if (item.getItem() instanceof ItemFluidDisplay) {
            FluidStack fluid = ((ItemFluidDisplay) item.getItem()).getFluid(item);
            if (fluid == null || fluid.amount <= 0)
                continue;
            stack = new OrderStack<>(fluid, i);
            tmp.add(stack);
        } else {
            stack = OrderStack.pack(compressed.get(i), i);
            if (stack != null)
                tmp.add(stack);
        }
    }
    return tmp;
}
Also used : PositionedStack(codechicken.nei.PositionedStack) OrderStack(com.glodblock.github.nei.object.OrderStack) FluidStack(net.minecraftforge.fluids.FluidStack) ItemFluidDisplay(gregapi.item.ItemFluidDisplay) ItemStack(net.minecraft.item.ItemStack) LinkedList(java.util.LinkedList)

Example 7 with OrderStack

use of com.glodblock.github.nei.object.OrderStack in project AE2FluidCraft-Rework by GlodBlock.

the class FluidPatternTerminalRecipeTransferHandler method overlayRecipe.

@Override
public void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift) {
    if (isCorrectGui(firstGui)) {
        List<OrderStack<?>> in = FluidRecipe.getPackageInputs(recipe, recipeIndex);
        List<OrderStack<?>> out = FluidRecipe.getPackageOutputs(recipe, recipeIndex, !notUseOther(recipe));
        boolean craft = shouldCraft(recipe);
        FluidCraft.proxy.netHandler.sendToServer(new CPacketTransferRecipe(in, out, craft));
    }
}
Also used : OrderStack(com.glodblock.github.nei.object.OrderStack) CPacketTransferRecipe(com.glodblock.github.network.CPacketTransferRecipe)

Example 8 with OrderStack

use of com.glodblock.github.nei.object.OrderStack in project AE2FluidCraft-Rework by GlodBlock.

the class EnderIORecipeExtractor method getOutputIngredients.

@Override
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe, int index) {
    TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
    List<OrderStack<?>> tmp = new LinkedList<>();
    if (tRecipe.arecipes.get(index) instanceof VatRecipeHandler.InnerVatRecipe) {
        VatRecipeHandler.InnerVatRecipe vatRecipe = (VatRecipeHandler.InnerVatRecipe) tRecipe.arecipes.get(index);
        FluidStack result = ReflectEIO.getResult(vatRecipe);
        if (result != null) {
            tmp.add(new OrderStack<>(result, 0));
        }
        return tmp;
    } else {
        return getOutputIngredients(rawOutputs);
    }
}
Also used : OrderStack(com.glodblock.github.nei.object.OrderStack) FluidStack(net.minecraftforge.fluids.FluidStack) TemplateRecipeHandler(codechicken.nei.recipe.TemplateRecipeHandler) LinkedList(java.util.LinkedList) VatRecipeHandler(crazypants.enderio.nei.VatRecipeHandler)

Example 9 with OrderStack

use of com.glodblock.github.nei.object.OrderStack in project AE2FluidCraft-Rework by GlodBlock.

the class GregTech6RecipeExtractor method getOutputIngredients.

@Override
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
    List<PositionedStack> compressed = compress(rawOutputs);
    List<OrderStack<?>> tmp = new LinkedList<>();
    for (int i = 0; i < compressed.size(); i++) {
        if (compressed.get(i) == null)
            continue;
        ItemStack item = compressed.get(i).items[0];
        OrderStack<?> stack;
        if (item.getItem() instanceof ItemFluidDisplay) {
            FluidStack fluid = ((ItemFluidDisplay) item.getItem()).getFluid(item);
            if (fluid == null || fluid.amount <= 0)
                continue;
            stack = new OrderStack<>(fluid, i);
            tmp.add(stack);
        } else {
            stack = OrderStack.pack(compressed.get(i), i);
            if (stack != null)
                tmp.add(stack);
        }
    }
    return tmp;
}
Also used : PositionedStack(codechicken.nei.PositionedStack) OrderStack(com.glodblock.github.nei.object.OrderStack) FluidStack(net.minecraftforge.fluids.FluidStack) ItemFluidDisplay(gregapi.item.ItemFluidDisplay) ItemStack(net.minecraft.item.ItemStack) LinkedList(java.util.LinkedList)

Aggregations

OrderStack (com.glodblock.github.nei.object.OrderStack)9 FluidStack (net.minecraftforge.fluids.FluidStack)8 PositionedStack (codechicken.nei.PositionedStack)7 LinkedList (java.util.LinkedList)6 TemplateRecipeHandler (codechicken.nei.recipe.TemplateRecipeHandler)4 ItemStack (net.minecraft.item.ItemStack)4 VatRecipeHandler (crazypants.enderio.nei.VatRecipeHandler)2 PositionedFluidTank (forestry.core.recipes.nei.PositionedFluidTank)2 NEIHandlerSqueezer (forestry.factory.recipes.nei.NEIHandlerSqueezer)2 ItemFluidDisplay (gregapi.item.ItemFluidDisplay)2 GT_FluidDisplayItem (gregtech.common.items.GT_FluidDisplayItem)2 ArrayList (java.util.ArrayList)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 CPacketTransferRecipe (com.glodblock.github.network.CPacketTransferRecipe)1