Search in sources :

Example 1 with MetallurgicInfuserRecipe

use of mekanism.api.recipes.MetallurgicInfuserRecipe in project Mekanism by mekanism.

the class MetallurgicInfuserRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof MetallurgicInfuserRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    MetallurgicInfuserRecipe recipe = (MetallurgicInfuserRecipe) iRecipe;
    List<@NonNull InfusionStack> infuseTypeRepresentations = recipe.getChemicalInput().getRepresentations();
    List<@NonNull ItemStack> itemRepresentations = recipe.getItemInput().getRepresentations();
    for (InfusionStack infuseTypeRepresentation : infuseTypeRepresentations) {
        NormalizedSimpleStack nssInfuseType = NSSInfuseType.createInfuseType(infuseTypeRepresentation);
        for (ItemStack itemRepresentation : itemRepresentations) {
            ItemStack output = recipe.getOutput(itemRepresentation, infuseTypeRepresentation);
            if (!output.isEmpty()) {
                IngredientHelper ingredientHelper = new IngredientHelper(mapper);
                ingredientHelper.put(nssInfuseType, infuseTypeRepresentation.getAmount());
                ingredientHelper.put(itemRepresentation);
                if (ingredientHelper.addAsConversion(output)) {
                    handled = true;
                }
            }
        }
    }
    return handled;
}
Also used : MetallurgicInfuserRecipe(mekanism.api.recipes.MetallurgicInfuserRecipe) NormalizedSimpleStack(moze_intel.projecte.api.nss.NormalizedSimpleStack) InfusionStack(mekanism.api.chemical.infuse.InfusionStack) ItemStack(net.minecraft.item.ItemStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper)

Aggregations

InfusionStack (mekanism.api.chemical.infuse.InfusionStack)1 MetallurgicInfuserRecipe (mekanism.api.recipes.MetallurgicInfuserRecipe)1 IngredientHelper (mekanism.common.integration.projecte.IngredientHelper)1 NormalizedSimpleStack (moze_intel.projecte.api.nss.NormalizedSimpleStack)1 ItemStack (net.minecraft.item.ItemStack)1