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;
}
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()])));
}
}
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()])));
}
}
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);
}
}
Aggregations