Search in sources :

Example 1 with PaintingRecipe

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

Aggregations

PigmentStack (mekanism.api.chemical.pigment.PigmentStack)1 PaintingRecipe (mekanism.api.recipes.PaintingRecipe)1 IngredientHelper (mekanism.common.integration.projecte.IngredientHelper)1 NormalizedSimpleStack (moze_intel.projecte.api.nss.NormalizedSimpleStack)1 ItemStack (net.minecraft.item.ItemStack)1