use of mekanism.api.recipes.CombinerRecipe in project Mekanism by mekanism.
the class CombinerRecipeMapper method handleRecipe.
@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
if (!(iRecipe instanceof CombinerRecipe)) {
// Double check that we have a type of recipe we know how to handle
return false;
}
boolean handled = false;
CombinerRecipe recipe = (CombinerRecipe) iRecipe;
List<@NonNull ItemStack> mainRepresentations = recipe.getMainInput().getRepresentations();
List<@NonNull ItemStack> extraRepresentations = recipe.getExtraInput().getRepresentations();
for (ItemStack mainRepresentation : mainRepresentations) {
NormalizedSimpleStack nssMain = NSSItem.createItem(mainRepresentation);
for (ItemStack extraRepresentation : extraRepresentations) {
ItemStack output = recipe.getOutput(mainRepresentation, extraRepresentation);
if (!output.isEmpty()) {
IngredientHelper ingredientHelper = new IngredientHelper(mapper);
ingredientHelper.put(nssMain, mainRepresentation.getCount());
ingredientHelper.put(extraRepresentation);
if (ingredientHelper.addAsConversion(output)) {
handled = true;
}
}
}
}
return handled;
}
Aggregations