Search in sources :

Example 1 with NormalizedSimpleStack

use of moze_intel.projecte.api.nss.NormalizedSimpleStack in project Mekanism by mekanism.

the class ChemicalInfuserRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof ChemicalInfuserRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    ChemicalInfuserRecipe recipe = (ChemicalInfuserRecipe) iRecipe;
    List<@NonNull GasStack> leftInputRepresentations = recipe.getLeftInput().getRepresentations();
    List<@NonNull GasStack> rightInputRepresentations = recipe.getRightInput().getRepresentations();
    for (GasStack leftRepresentation : leftInputRepresentations) {
        NormalizedSimpleStack nssLeft = NSSGas.createGas(leftRepresentation);
        for (GasStack rightRepresentation : rightInputRepresentations) {
            GasStack 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) ChemicalInfuserRecipe(mekanism.api.recipes.ChemicalInfuserRecipe) GasStack(mekanism.api.chemical.gas.GasStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper)

Example 2 with NormalizedSimpleStack

use of moze_intel.projecte.api.nss.NormalizedSimpleStack 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)

Example 3 with NormalizedSimpleStack

use of moze_intel.projecte.api.nss.NormalizedSimpleStack in project Mekanism by mekanism.

the class ElectrolysisRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof ElectrolysisRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    ElectrolysisRecipe recipe = (ElectrolysisRecipe) iRecipe;
    FluidStackIngredient input = recipe.getInput();
    for (FluidStack representation : input.getRepresentations()) {
        Pair<@NonNull GasStack, @NonNull GasStack> output = recipe.getOutput(representation);
        GasStack leftOutput = output.getLeft();
        GasStack rightOutput = output.getRight();
        if (!leftOutput.isEmpty() && !rightOutput.isEmpty()) {
            NormalizedSimpleStack nssInput = NSSFluid.createFluid(representation);
            NormalizedSimpleStack nssLeftOutput = NSSGas.createGas(leftOutput);
            NormalizedSimpleStack nssRightOutput = NSSGas.createGas(rightOutput);
            // Add trying to calculate left output (using it as if we needed negative of right output)
            IngredientHelper ingredientHelper = new IngredientHelper(mapper);
            ingredientHelper.put(nssInput, representation.getAmount());
            ingredientHelper.put(nssRightOutput, -rightOutput.getAmount());
            if (ingredientHelper.addAsConversion(nssLeftOutput, leftOutput.getAmount())) {
                handled = true;
            }
            // Add trying to calculate right output (using it as if we needed negative of left output)
            ingredientHelper.resetHelper();
            ingredientHelper.put(nssInput, representation.getAmount());
            ingredientHelper.put(nssLeftOutput, -leftOutput.getAmount());
            if (ingredientHelper.addAsConversion(nssRightOutput, rightOutput.getAmount())) {
                handled = true;
            }
        }
    }
    return handled;
}
Also used : NormalizedSimpleStack(moze_intel.projecte.api.nss.NormalizedSimpleStack) FluidStackIngredient(mekanism.api.recipes.inputs.FluidStackIngredient) ElectrolysisRecipe(mekanism.api.recipes.ElectrolysisRecipe) FluidStack(net.minecraftforge.fluids.FluidStack) GasStack(mekanism.api.chemical.gas.GasStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper)

Example 4 with NormalizedSimpleStack

use of moze_intel.projecte.api.nss.NormalizedSimpleStack in project Mekanism by mekanism.

the class FluidSlurryToSlurryRecipeMapper method handleRecipe.

@Override
public boolean handleRecipe(IMappingCollector<NormalizedSimpleStack, Long> mapper, IRecipe<?> iRecipe, INSSFakeGroupManager groupManager) {
    if (!(iRecipe instanceof FluidSlurryToSlurryRecipe)) {
        // Double check that we have a type of recipe we know how to handle
        return false;
    }
    boolean handled = false;
    FluidSlurryToSlurryRecipe recipe = (FluidSlurryToSlurryRecipe) iRecipe;
    List<@NonNull FluidStack> fluidRepresentations = recipe.getFluidInput().getRepresentations();
    List<@NonNull SlurryStack> slurryRepresentations = recipe.getChemicalInput().getRepresentations();
    for (FluidStack fluidRepresentation : fluidRepresentations) {
        NormalizedSimpleStack nssFluid = NSSFluid.createFluid(fluidRepresentation);
        for (SlurryStack slurryRepresentation : slurryRepresentations) {
            SlurryStack output = recipe.getOutput(fluidRepresentation, slurryRepresentation);
            if (!output.isEmpty()) {
                IngredientHelper ingredientHelper = new IngredientHelper(mapper);
                ingredientHelper.put(nssFluid, fluidRepresentation.getAmount());
                ingredientHelper.put(slurryRepresentation);
                if (ingredientHelper.addAsConversion(output)) {
                    handled = true;
                }
            }
        }
    }
    return handled;
}
Also used : NormalizedSimpleStack(moze_intel.projecte.api.nss.NormalizedSimpleStack) FluidSlurryToSlurryRecipe(mekanism.api.recipes.FluidSlurryToSlurryRecipe) FluidStack(net.minecraftforge.fluids.FluidStack) IngredientHelper(mekanism.common.integration.projecte.IngredientHelper) SlurryStack(mekanism.api.chemical.slurry.SlurryStack)

Example 5 with NormalizedSimpleStack

use of moze_intel.projecte.api.nss.NormalizedSimpleStack 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

IngredientHelper (mekanism.common.integration.projecte.IngredientHelper)9 NormalizedSimpleStack (moze_intel.projecte.api.nss.NormalizedSimpleStack)9 ItemStack (net.minecraft.item.ItemStack)5 GasStack (mekanism.api.chemical.gas.GasStack)3 FluidStack (net.minecraftforge.fluids.FluidStack)3 PigmentStack (mekanism.api.chemical.pigment.PigmentStack)2 InfusionStack (mekanism.api.chemical.infuse.InfusionStack)1 SlurryStack (mekanism.api.chemical.slurry.SlurryStack)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 MetallurgicInfuserRecipe (mekanism.api.recipes.MetallurgicInfuserRecipe)1 PaintingRecipe (mekanism.api.recipes.PaintingRecipe)1 PigmentMixingRecipe (mekanism.api.recipes.PigmentMixingRecipe)1 PressurizedReactionRecipe (mekanism.api.recipes.PressurizedReactionRecipe)1 SawmillRecipe (mekanism.api.recipes.SawmillRecipe)1 ChanceOutput (mekanism.api.recipes.SawmillRecipe.ChanceOutput)1 FluidStackIngredient (mekanism.api.recipes.inputs.FluidStackIngredient)1 ItemStackIngredient (mekanism.api.recipes.inputs.ItemStackIngredient)1