Search in sources :

Example 1 with CombinerRecipe

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;
}
Also used : NormalizedSimpleStack(moze_intel.projecte.api.nss.NormalizedSimpleStack) CombinerRecipe(mekanism.api.recipes.CombinerRecipe) ItemStack(net.minecraft.item.ItemStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper)

Aggregations

CombinerRecipe (mekanism.api.recipes.CombinerRecipe)1 IngredientHelper (mekanism.common.integration.projecte.IngredientHelper)1 NormalizedSimpleStack (moze_intel.projecte.api.nss.NormalizedSimpleStack)1 ItemStack (net.minecraft.item.ItemStack)1