Search in sources :

Example 1 with OrderStack

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

the class EnderIORecipeExtractor method getInputIngredients.

@Override
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, 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);
        ArrayList<PositionedStack> inputs = ReflectEIO.getInputs(vatRecipe);
        for (int i = 0; i < inputs.size(); i++) {
            if (inputs.get(i) == null)
                continue;
            OrderStack<?> stack = OrderStack.pack(rawInputs.get(i), i);
            if (stack != null)
                tmp.add(stack);
        }
        FluidStack in = ReflectEIO.getInputFluid(vatRecipe);
        if (in != null) {
            tmp.add(new OrderStack<>(in, inputs.size()));
        }
        return tmp;
    } else if (tRecipe.getOverlayIdentifier().equals("EnderIOSagMill")) {
        for (int i = rawInputs.size() - 1; i >= 0; i--) {
            PositionedStack stack = rawInputs.get(i);
            if (stack != null && CrusherRecipeManager.getInstance().isValidSagBall(stack.items[0])) {
                rawInputs.remove(i);
                break;
            }
        }
        return getInputIngredients(rawInputs);
    } else {
        return getInputIngredients(rawInputs);
    }
}
Also used : PositionedStack(codechicken.nei.PositionedStack) 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 2 with OrderStack

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

the class ForestryRecipeExtractor method getOutputIngredients.

@Override
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe, int index) {
    TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
    removeGlass(rawOutputs);
    List<OrderStack<?>> tmp = new ArrayList<>();
    List<PositionedStack> compressed = compress(rawOutputs);
    if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
        tmp = getOutputIngredients(compressed);
        List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
        if (tanks.size() > 0 && handler instanceof NEIHandlerSqueezer) {
            FluidStack fluid = tanks.get(0).tank.getFluid();
            if (fluid != null) {
                tmp.add(new OrderStack<>(fluid, compressed.size()));
            }
        } else if (tanks.size() > 1) {
            FluidStack fluid = tanks.get(1).tank.getFluid();
            if (fluid != null) {
                tmp.add(new OrderStack<>(fluid, compressed.size()));
            }
        }
    }
    return tmp;
}
Also used : NEIHandlerSqueezer(forestry.factory.recipes.nei.NEIHandlerSqueezer) PositionedStack(codechicken.nei.PositionedStack) OrderStack(com.glodblock.github.nei.object.OrderStack) PositionedFluidTank(forestry.core.recipes.nei.PositionedFluidTank) FluidStack(net.minecraftforge.fluids.FluidStack) ArrayList(java.util.ArrayList) TemplateRecipeHandler(codechicken.nei.recipe.TemplateRecipeHandler)

Example 3 with OrderStack

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

the class ForestryRecipeExtractor method getInputIngredients.

@Override
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
    TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
    List<OrderStack<?>> tmp = new ArrayList<>();
    List<PositionedStack> compressed = compress(rawInputs);
    if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
        tmp = getInputIngredients(compressed);
        List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index)).getFluidTanks();
        if (tanks.size() > 0 && !(handler instanceof NEIHandlerSqueezer)) {
            FluidStack fluid = tanks.get(0).tank.getFluid();
            if (fluid != null) {
                tmp.add(new OrderStack<>(fluid, compressed.size()));
            }
        }
    }
    return tmp;
}
Also used : NEIHandlerSqueezer(forestry.factory.recipes.nei.NEIHandlerSqueezer) PositionedStack(codechicken.nei.PositionedStack) OrderStack(com.glodblock.github.nei.object.OrderStack) PositionedFluidTank(forestry.core.recipes.nei.PositionedFluidTank) FluidStack(net.minecraftforge.fluids.FluidStack) ArrayList(java.util.ArrayList) TemplateRecipeHandler(codechicken.nei.recipe.TemplateRecipeHandler)

Example 4 with OrderStack

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

the class GregTech5RecipeExtractor 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 GT_FluidDisplayItem) {
            NBTTagCompound aNBT = item.getTagCompound();
            int amt = (int) aNBT.getLong("mFluidDisplayAmount");
            if (amt <= 0)
                continue;
            stack = new OrderStack<>(new FluidStack(FluidRegistry.getFluid(item.getItemDamage()), amt), i);
            tmp.add(stack);
        } else {
            stack = OrderStack.pack(compressed.get(i), i);
            if (stack != null)
                tmp.add(stack);
        }
    }
    return tmp;
}
Also used : GT_FluidDisplayItem(gregtech.common.items.GT_FluidDisplayItem) PositionedStack(codechicken.nei.PositionedStack) OrderStack(com.glodblock.github.nei.object.OrderStack) FluidStack(net.minecraftforge.fluids.FluidStack) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack) LinkedList(java.util.LinkedList)

Example 5 with OrderStack

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

the class GregTech5RecipeExtractor method getInputIngredients.

@Override
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
    if (r)
        removeSpecial(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 GT_FluidDisplayItem) {
            NBTTagCompound aNBT = item.getTagCompound();
            int amt = (int) aNBT.getLong("mFluidDisplayAmount");
            if (amt <= 0)
                continue;
            stack = new OrderStack<>(new FluidStack(FluidRegistry.getFluid(item.getItemDamage()), amt), i);
            tmp.add(stack);
        } else {
            stack = OrderStack.pack(compressed.get(i), i);
            if (stack != null)
                tmp.add(stack);
        }
    }
    return tmp;
}
Also used : GT_FluidDisplayItem(gregtech.common.items.GT_FluidDisplayItem) PositionedStack(codechicken.nei.PositionedStack) OrderStack(com.glodblock.github.nei.object.OrderStack) FluidStack(net.minecraftforge.fluids.FluidStack) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) 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