Search in sources :

Example 1 with IRecipeInput

use of crazypants.enderio.base.recipe.IRecipeInput in project EnderIO by SleepyTrousers.

the class VatRecipeManager method getMultiplierForInput.

public float getMultiplierForInput(Fluid inputFluid, @Nonnull ItemStack input, Fluid output) {
    if (Prep.isValid(input) || output != null) {
        for (IRecipe recipe : recipes) {
            RecipeOutput out = recipe.getOutputs()[0];
            IRecipeInput in = recipe.getInputs()[recipe.getInputs().length - 1];
            final FluidStack fluidOutput = out.getFluidOutput();
            if ((inputFluid == null || FluidUtil.areFluidsTheSame(in.getFluidInput().getFluid(), inputFluid) && (output == null || (fluidOutput != null && FluidUtil.areFluidsTheSame(fluidOutput.getFluid(), output))))) {
                for (IRecipeInput ri : recipe.getInputs()) {
                    if (ri.isInput(input)) {
                        return ri.getMulitplier();
                    }
                }
            }
        }
    }
    // no fluid or not an input for this fluid: best guess
    // (after all, the item IS in the input slot)
    float found = -1f;
    for (IRecipe recipe : recipes) {
        for (IRecipeInput ri : recipe.getInputs()) {
            if (ri.isInput(input)) {
                if (found < 0f || found > ri.getMulitplier()) {
                    found = ri.getMulitplier();
                }
            }
        }
    }
    return found > 0 ? found : 0;
}
Also used : IRecipeInput(crazypants.enderio.base.recipe.IRecipeInput) IRecipe(crazypants.enderio.base.recipe.IRecipe) FluidStack(net.minecraftforge.fluids.FluidStack) RecipeOutput(crazypants.enderio.base.recipe.RecipeOutput)

Example 2 with IRecipeInput

use of crazypants.enderio.base.recipe.IRecipeInput in project EnderIO by SleepyTrousers.

the class Fermenting method register.

@Override
public void register(@Nonnull String recipeName) {
    if (isValid() && isActive()) {
        NNList<IRecipeInput> inputStacks = new NNList<>();
        int slot = 0;
        for (NNIterator<Inputgroup> itr = inputgroup.fastIterator(); itr.hasNext(); ) {
            for (NNIterator<ItemMultiplier> itr2 = itr.next().getItems().fastIterator(); itr2.hasNext(); ) {
                ItemMultiplier item = itr2.next();
                inputStacks.add(new ThingsRecipeInput(item.getThing(), slot, item.multiplier));
            }
            slot++;
        }
        inputStacks.add(new RecipeInput(inputfluid.getFluidStack(), inputfluid.multiplier));
        RecipeOutput recipeOutput = new RecipeOutput(outputfluid.getFluidStack());
        VatRecipeManager.getInstance().addRecipe(new Recipe(recipeOutput, energy, RecipeBonusType.NONE, inputStacks.toArray(new IRecipeInput[inputStacks.size()])));
    }
}
Also used : IRecipeInput(crazypants.enderio.base.recipe.IRecipeInput) RecipeInput(crazypants.enderio.base.recipe.RecipeInput) IRecipeInput(crazypants.enderio.base.recipe.IRecipeInput) ThingsRecipeInput(crazypants.enderio.base.recipe.ThingsRecipeInput) Recipe(crazypants.enderio.base.recipe.Recipe) NNList(com.enderio.core.common.util.NNList) RecipeOutput(crazypants.enderio.base.recipe.RecipeOutput) ThingsRecipeInput(crazypants.enderio.base.recipe.ThingsRecipeInput)

Example 3 with IRecipeInput

use of crazypants.enderio.base.recipe.IRecipeInput in project EnderIO by SleepyTrousers.

the class Slicing method register.

@Override
public void register(@Nonnull String recipeName) {
    if (isValid() && isActive()) {
        NNList<IRecipeInput> inputStacks = new NNList<>();
        for (NNIterator<Item> itr = inputs.fastIterator(); itr.hasNext(); ) {
            final Item item = itr.next();
            inputStacks.add(new ThingsRecipeInput(item.getThing(), inputStacks.size()));
        }
        RecipeOutput recipeOutput = new RecipeOutput(getOutput().getItemStack());
        SliceAndSpliceRecipeManager.getInstance().addRecipe(new Recipe(recipeOutput, energy, RecipeBonusType.NONE, inputStacks.toArray(new IRecipeInput[inputStacks.size()])));
    }
}
Also used : IRecipeInput(crazypants.enderio.base.recipe.IRecipeInput) Recipe(crazypants.enderio.base.recipe.Recipe) NNList(com.enderio.core.common.util.NNList) RecipeOutput(crazypants.enderio.base.recipe.RecipeOutput) ThingsRecipeInput(crazypants.enderio.base.recipe.ThingsRecipeInput)

Example 4 with IRecipeInput

use of crazypants.enderio.base.recipe.IRecipeInput in project EnderIO by SleepyTrousers.

the class PaintSourceValidator method removeFromList.

protected void removeFromList(IRecipeInput input, List<RecipeInput> list) {
    ItemStack inStack = input.getInput();
    if (Prep.isInvalid(inStack)) {
        return;
    }
    IRecipeInput toRemove = null;
    for (IRecipeInput in : list) {
        if (ItemUtil.areStacksEqual(inStack, in.getInput())) {
            toRemove = in;
            break;
        }
    }
    if (toRemove != null) {
        list.remove(toRemove);
    }
}
Also used : IRecipeInput(crazypants.enderio.base.recipe.IRecipeInput) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IRecipeInput (crazypants.enderio.base.recipe.IRecipeInput)4 RecipeOutput (crazypants.enderio.base.recipe.RecipeOutput)3 NNList (com.enderio.core.common.util.NNList)2 Recipe (crazypants.enderio.base.recipe.Recipe)2 ThingsRecipeInput (crazypants.enderio.base.recipe.ThingsRecipeInput)2 IRecipe (crazypants.enderio.base.recipe.IRecipe)1 RecipeInput (crazypants.enderio.base.recipe.RecipeInput)1 ItemStack (net.minecraft.item.ItemStack)1 FluidStack (net.minecraftforge.fluids.FluidStack)1