Search in sources :

Example 16 with IngredientHelper

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

the class ChemicalDissolutionRecipeMapper method handleRecipe.

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

Example 17 with IngredientHelper

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

the class FluidToFluidRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof FluidToFluidRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    FluidToFluidRecipe recipe = (FluidToFluidRecipe) iRecipe;
    for (FluidStack representation : recipe.getInput().getRepresentations()) {
        FluidStack 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 : FluidStack(net.minecraftforge.fluids.FluidStack) FluidToFluidRecipe(mekanism.api.recipes.FluidToFluidRecipe) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper)

Example 18 with IngredientHelper

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

the class ItemStackToGasRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof ItemStackToGasRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    ItemStackToGasRecipe recipe = (ItemStackToGasRecipe) iRecipe;
    for (ItemStack representation : recipe.getInput().getRepresentations()) {
        GasStack 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 : ItemStackToGasRecipe(mekanism.api.recipes.ItemStackToGasRecipe) GasStack(mekanism.api.chemical.gas.GasStack) ItemStack(net.minecraft.item.ItemStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper)

Example 19 with IngredientHelper

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

the class ItemStackToInfuseTypeRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof ItemStackToInfuseTypeRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    ItemStackToInfuseTypeRecipe recipe = (ItemStackToInfuseTypeRecipe) iRecipe;
    for (ItemStack representation : recipe.getInput().getRepresentations()) {
        InfusionStack 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 : InfusionStack(mekanism.api.chemical.infuse.InfusionStack) ItemStackToInfuseTypeRecipe(mekanism.api.recipes.ItemStackToInfuseTypeRecipe) ItemStack(net.minecraft.item.ItemStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper)

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