use of mekanism.api.recipes.PigmentMixingRecipe in project Mekanism by mekanism.
the class PigmentMixerRecipeMapper method handleRecipe.
@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
if (!(iRecipe instanceof PigmentMixingRecipe)) {
// Double check that we have a type of recipe we know how to handle
return false;
}
boolean handled = false;
PigmentMixingRecipe recipe = (PigmentMixingRecipe) iRecipe;
List<@NonNull PigmentStack> leftInputRepresentations = recipe.getLeftInput().getRepresentations();
List<@NonNull PigmentStack> rightInputRepresentations = recipe.getRightInput().getRepresentations();
for (PigmentStack leftRepresentation : leftInputRepresentations) {
NormalizedSimpleStack nssLeft = NSSPigment.createPigment(leftRepresentation);
for (PigmentStack rightRepresentation : rightInputRepresentations) {
PigmentStack 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