use of mekanism.api.recipes.PaintingRecipe in project Mekanism by mekanism.
the class PaintingMachineRecipeMapper method handleRecipe.
@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
if (!(iRecipe instanceof PaintingRecipe)) {
// Double check that we have a type of recipe we know how to handle
return false;
}
boolean handled = false;
PaintingRecipe recipe = (PaintingRecipe) iRecipe;
List<@NonNull PigmentStack> pigmentRepresentations = recipe.getChemicalInput().getRepresentations();
List<@NonNull ItemStack> itemRepresentations = recipe.getItemInput().getRepresentations();
for (PigmentStack pigmentRepresentation : pigmentRepresentations) {
NormalizedSimpleStack nssPigment = NSSPigment.createPigment(pigmentRepresentation);
for (ItemStack itemRepresentation : itemRepresentations) {
ItemStack output = recipe.getOutput(itemRepresentation, pigmentRepresentation);
if (!output.isEmpty()) {
IngredientHelper ingredientHelper = new IngredientHelper(mapper);
ingredientHelper.put(nssPigment, pigmentRepresentation.getAmount());
ingredientHelper.put(itemRepresentation);
if (ingredientHelper.addAsConversion(output)) {
handled = true;
}
}
}
}
return handled;
}
Aggregations