Search in sources :

Example 1 with FluidSlurryToSlurryRecipe

use of mekanism.api.recipes.FluidSlurryToSlurryRecipe in project Mekanism by mekanism.

the class FluidSlurryToSlurryRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof FluidSlurryToSlurryRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    FluidSlurryToSlurryRecipe recipe = (FluidSlurryToSlurryRecipe) iRecipe;
    List<@NonNull FluidStack> fluidRepresentations = recipe.getFluidInput().getRepresentations();
    List<@NonNull SlurryStack> slurryRepresentations = recipe.getChemicalInput().getRepresentations();
    for (FluidStack fluidRepresentation : fluidRepresentations) {
        NormalizedSimpleStack nssFluid = NSSFluid.createFluid(fluidRepresentation);
        for (SlurryStack slurryRepresentation : slurryRepresentations) {
            SlurryStack output = recipe.getOutput(fluidRepresentation, slurryRepresentation);
            if (!output.isEmpty()) {
                IngredientHelper ingredientHelper = new IngredientHelper(mapper);
                ingredientHelper.put(nssFluid, fluidRepresentation.getAmount());
                ingredientHelper.put(slurryRepresentation);
                if (ingredientHelper.addAsConversion(output)) {
                    handled = true;
                }
            }
        }
    }
    return handled;
}
Also used : NormalizedSimpleStack(moze_intel.projecte.api.nss.NormalizedSimpleStack) FluidSlurryToSlurryRecipe(mekanism.api.recipes.FluidSlurryToSlurryRecipe) FluidStack(net.minecraftforge.fluids.FluidStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper) SlurryStack(mekanism.api.chemical.slurry.SlurryStack)

Aggregations

SlurryStack (mekanism.api.chemical.slurry.SlurryStack)1 FluidSlurryToSlurryRecipe (mekanism.api.recipes.FluidSlurryToSlurryRecipe)1 IngredientHelper (mekanism.common.integration.projecte.IngredientHelper)1 NormalizedSimpleStack (moze_intel.projecte.api.nss.NormalizedSimpleStack)1 FluidStack (net.minecraftforge.fluids.FluidStack)1