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;
}
Aggregations