Search in sources :

Example 1 with NSSGas

use of mekanism.common.integration.projecte.NSSGas 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 2 with NSSGas

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

Aggregations

GasStack (mekanism.api.chemical.gas.GasStack)2 IngredientHelper (mekanism.common.integration.projecte.IngredientHelper)2 NSSGas (mekanism.common.integration.projecte.NSSGas)2 ItemStack (net.minecraft.item.ItemStack)2 BoxedChemicalStack (mekanism.api.chemical.merged.BoxedChemicalStack)1 ChemicalDissolutionRecipe (mekanism.api.recipes.ChemicalDissolutionRecipe)1 ItemStackGasToItemStackRecipe (mekanism.api.recipes.ItemStackGasToItemStackRecipe)1