Search in sources :

Example 6 with IngredientHelper

use of mekanism.common.integration.projecte.IngredientHelper in project Mekanism by mekanism.

the class ItemStackGasToItemStackRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof ItemStackGasToItemStackRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    ItemStackGasToItemStackRecipe recipe = (ItemStackGasToItemStackRecipe) iRecipe;
    List<@NonNull ItemStack> itemRepresentations = recipe.getItemInput().getRepresentations();
    List<@NonNull GasStack> gasRepresentations = recipe.getChemicalInput().getRepresentations();
    for (GasStack gasRepresentation : gasRepresentations) {
        NSSGas nssGas = NSSGas.createGas(gasRepresentation);
        long gasAmount = gasRepresentation.getAmount() * TileEntityAdvancedElectricMachine.BASE_TICKS_REQUIRED;
        for (ItemStack itemRepresentation : itemRepresentations) {
            ItemStack output = recipe.getOutput(itemRepresentation, gasRepresentation);
            if (!output.isEmpty()) {
                IngredientHelper ingredientHelper = new IngredientHelper(mapper);
                ingredientHelper.put(itemRepresentation);
                ingredientHelper.put(nssGas, gasAmount);
                if (ingredientHelper.addAsConversion(output)) {
                    handled = true;
                }
            }
        }
    }
    return handled;
}
Also used : ItemStackGasToItemStackRecipe(mekanism.api.recipes.ItemStackGasToItemStackRecipe) NSSGas(mekanism.common.integration.projecte.NSSGas) GasStack(mekanism.api.chemical.gas.GasStack) ItemStack(net.minecraft.item.ItemStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper)

Example 7 with IngredientHelper

use of mekanism.common.integration.projecte.IngredientHelper in project Mekanism by mekanism.

the class ItemStackToItemStackRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof ItemStackToItemStackRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    ItemStackToItemStackRecipe recipe = (ItemStackToItemStackRecipe) iRecipe;
    for (ItemStack representation : recipe.getInput().getRepresentations()) {
        ItemStack output = recipe.getOutput(representation);
        if (!output.isEmpty()) {
            IngredientHelper ingredientHelper = new IngredientHelper(mapper);
            ingredientHelper.put(representation);
            if (ingredientHelper.addAsConversion(output)) {
                handled = true;
            }
        }
    }
    return handled;
}
Also used : ItemStackToItemStackRecipe(mekanism.api.recipes.ItemStackToItemStackRecipe) ItemStack(net.minecraft.item.ItemStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper)

Example 8 with IngredientHelper

use of mekanism.common.integration.projecte.IngredientHelper 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)

Example 9 with IngredientHelper

use of mekanism.common.integration.projecte.IngredientHelper 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)

Example 10 with IngredientHelper

use of mekanism.common.integration.projecte.IngredientHelper in project Mekanism by mekanism.

the class PigmentMixerRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof PigmentMixingRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    PigmentMixingRecipe recipe = (PigmentMixingRecipe) iRecipe;
    List<@NonNull PigmentStack> leftInputRepresentations = recipe.getLeftInput().getRepresentations();
    List<@NonNull PigmentStack> rightInputRepresentations = recipe.getRightInput().getRepresentations();
    for (PigmentStack leftRepresentation : leftInputRepresentations) {
        NormalizedSimpleStack nssLeft = NSSPigment.createPigment(leftRepresentation);
        for (PigmentStack rightRepresentation : rightInputRepresentations) {
            PigmentStack output = recipe.getOutput(leftRepresentation, rightRepresentation);
            if (!output.isEmpty()) {
                IngredientHelper ingredientHelper = new IngredientHelper(mapper);
                ingredientHelper.put(nssLeft, leftRepresentation.getAmount());
                ingredientHelper.put(rightRepresentation);
                if (ingredientHelper.addAsConversion(output)) {
                    handled = true;
                }
            }
        }
    }
    return handled;
}
Also used : NormalizedSimpleStack(moze_intel.projecte.api.nss.NormalizedSimpleStack) PigmentStack(mekanism.api.chemical.pigment.PigmentStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper) PigmentMixingRecipe(mekanism.api.recipes.PigmentMixingRecipe)

Aggregations

IngredientHelper (mekanism.common.integration.projecte.IngredientHelper)19 ItemStack (net.minecraft.item.ItemStack)12 NormalizedSimpleStack (moze_intel.projecte.api.nss.NormalizedSimpleStack)9 GasStack (mekanism.api.chemical.gas.GasStack)8 FluidStack (net.minecraftforge.fluids.FluidStack)5 PigmentStack (mekanism.api.chemical.pigment.PigmentStack)3 InfusionStack (mekanism.api.chemical.infuse.InfusionStack)2 NSSGas (mekanism.common.integration.projecte.NSSGas)2 BoxedChemicalStack (mekanism.api.chemical.merged.BoxedChemicalStack)1 SlurryStack (mekanism.api.chemical.slurry.SlurryStack)1 ChemicalCrystallizerRecipe (mekanism.api.recipes.ChemicalCrystallizerRecipe)1 ChemicalDissolutionRecipe (mekanism.api.recipes.ChemicalDissolutionRecipe)1 ChemicalInfuserRecipe (mekanism.api.recipes.ChemicalInfuserRecipe)1 CombinerRecipe (mekanism.api.recipes.CombinerRecipe)1 ElectrolysisRecipe (mekanism.api.recipes.ElectrolysisRecipe)1 FluidSlurryToSlurryRecipe (mekanism.api.recipes.FluidSlurryToSlurryRecipe)1 FluidToFluidRecipe (mekanism.api.recipes.FluidToFluidRecipe)1 GasToGasRecipe (mekanism.api.recipes.GasToGasRecipe)1 ItemStackGasToItemStackRecipe (mekanism.api.recipes.ItemStackGasToItemStackRecipe)1 ItemStackToGasRecipe (mekanism.api.recipes.ItemStackToGasRecipe)1