Search in sources :

Example 1 with ChemicalInfuserRecipe

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

the class ChemicalInfuserRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof ChemicalInfuserRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    ChemicalInfuserRecipe recipe = (ChemicalInfuserRecipe) iRecipe;
    List<@NonNull GasStack> leftInputRepresentations = recipe.getLeftInput().getRepresentations();
    List<@NonNull GasStack> rightInputRepresentations = recipe.getRightInput().getRepresentations();
    for (GasStack leftRepresentation : leftInputRepresentations) {
        NormalizedSimpleStack nssLeft = NSSGas.createGas(leftRepresentation);
        for (GasStack rightRepresentation : rightInputRepresentations) {
            GasStack output = recipe.getOutput(leftRepresentation, rightRepresentation);
            if (!output.isEmpty()) {
                IngredientHelper ingredientHelper = new IngredientHelper(mapper);
                ingredientHelper.put(nssLeft, leftRepresentation.getAmount());
                ingredientHelper.put(rightRepresentation);
                if (ingredientHelper.addAsConversion(output)) {
                    handled = true;
                }
            }
        }
    }
    return handled;
}
Also used : NormalizedSimpleStack(moze_intel.projecte.api.nss.NormalizedSimpleStack) ChemicalInfuserRecipe(mekanism.api.recipes.ChemicalInfuserRecipe) GasStack(mekanism.api.chemical.gas.GasStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper)

Aggregations

GasStack (mekanism.api.chemical.gas.GasStack)1 ChemicalInfuserRecipe (mekanism.api.recipes.ChemicalInfuserRecipe)1 IngredientHelper (mekanism.common.integration.projecte.IngredientHelper)1 NormalizedSimpleStack (moze_intel.projecte.api.nss.NormalizedSimpleStack)1