Search in sources :

Example 1 with IVariableFermentable

use of forestry.api.recipes.IVariableFermentable in project ForestryMC by ForestryMC.

the class FermenterRecipeWrapper method getIngredients.

@Override
public void getIngredients(IIngredients ingredients) {
    List<ItemStack> fuelInputs = new ArrayList<>();
    for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
        fuelInputs.add(fuel.getItem());
    }
    ingredients.setInputLists(ItemStack.class, Arrays.asList(Collections.singletonList(fermentable), fuelInputs));
    FluidStack fluidInput = getRecipe().getFluidResource().copy();
    fluidInput.amount = getRecipe().getFermentationValue();
    ingredients.setInput(FluidStack.class, fluidInput);
    int amount = Math.round(getRecipe().getFermentationValue() * getRecipe().getModifier());
    if (fermentable.getItem() instanceof IVariableFermentable) {
        amount *= ((IVariableFermentable) fermentable.getItem()).getFermentationModifier(fermentable);
    }
    FluidStack fluidOutput = new FluidStack(getRecipe().getOutput(), amount);
    ingredients.setOutput(FluidStack.class, fluidOutput);
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) IVariableFermentable(forestry.api.recipes.IVariableFermentable) ArrayList(java.util.ArrayList) FermenterFuel(forestry.api.fuels.FermenterFuel) ItemStack(net.minecraft.item.ItemStack)

Aggregations

FermenterFuel (forestry.api.fuels.FermenterFuel)1 IVariableFermentable (forestry.api.recipes.IVariableFermentable)1 ArrayList (java.util.ArrayList)1 ItemStack (net.minecraft.item.ItemStack)1 FluidStack (net.minecraftforge.fluids.FluidStack)1