Search in sources :

Example 1 with BlastRecipeBuilder

use of gregtech.api.recipes.builders.BlastRecipeBuilder in project GregTech by GregTechCE.

the class MaterialRecipeHandler method processDust.

public static void processDust(OrePrefix dustPrefix, DustMaterial material) {
    if (material instanceof GemMaterial) {
        ItemStack gemStack = OreDictUnifier.get(OrePrefix.gem, material);
        ItemStack tinyDarkAshStack = OreDictUnifier.get(OrePrefix.dustTiny, Materials.DarkAsh);
        if (material.hasFlag(GemMaterial.MatFlags.CRYSTALLISABLE)) {
            RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder().input(dustPrefix, material).fluidInputs(Materials.Water.getFluid(200)).chancedOutput(gemStack, 7000, 1000).duration(1600).EUt(24).buildAndRegister();
            RecipeMaps.AUTOCLAVE_RECIPES.recipeBuilder().input(dustPrefix, material).fluidInputs(ModHandler.getDistilledWater(200)).chancedOutput(gemStack, 8000, 1000).duration(1200).EUt(24).buildAndRegister();
        } else if (!material.hasFlag(Material.MatFlags.EXPLOSIVE) && !material.hasFlag(Material.MatFlags.FLAMMABLE)) {
            RecipeMaps.IMPLOSION_RECIPES.recipeBuilder().input(dustPrefix, material, 4).outputs(GTUtility.copyAmount(3, gemStack), GTUtility.copyAmount(2, tinyDarkAshStack)).explosivesAmount(4).buildAndRegister();
        }
    } else if (material instanceof IngotMaterial) {
        IngotMaterial metalMaterial = (IngotMaterial) material;
        if (!material.hasFlag(Material.MatFlags.FLAMMABLE | MatFlags.NO_SMELTING)) {
            boolean hasHotIngot = OrePrefix.ingotHot.doGenerateItem(metalMaterial);
            ItemStack ingotStack = OreDictUnifier.get(hasHotIngot ? OrePrefix.ingotHot : OrePrefix.ingot, metalMaterial);
            ItemStack nuggetStack = OreDictUnifier.get(OrePrefix.nugget, metalMaterial);
            if (metalMaterial.blastFurnaceTemperature <= 0) {
                ModHandler.addSmeltingRecipe(new UnificationEntry(dustPrefix, metalMaterial), ingotStack);
                ModHandler.addSmeltingRecipe(new UnificationEntry(OrePrefix.dustTiny, metalMaterial), nuggetStack);
            } else {
                int duration = Math.max(1, (int) (material.getAverageMass() * metalMaterial.blastFurnaceTemperature / 50L));
                ModHandler.removeFurnaceSmelting(new UnificationEntry(OrePrefix.ingot, metalMaterial));
                BlastRecipeBuilder ingotSmeltingBuilder = RecipeMaps.BLAST_RECIPES.recipeBuilder().input(dustPrefix, material).outputs(ingotStack).blastFurnaceTemp(metalMaterial.blastFurnaceTemperature).duration(duration).EUt(120);
                if (circuitRequiringMaterials.contains(material)) {
                    ingotSmeltingBuilder.inputs(new CountableIngredient(new IntCircuitIngredient(0), 0));
                }
                ingotSmeltingBuilder.buildAndRegister();
                if (!hasHotIngot) {
                    BlastRecipeBuilder nuggetSmeltingBuilder = RecipeMaps.BLAST_RECIPES.recipeBuilder().input(OrePrefix.dustTiny, material).outputs(nuggetStack).blastFurnaceTemp(metalMaterial.blastFurnaceTemperature).duration(Math.max(1, duration / 9)).EUt(120);
                    if (circuitRequiringMaterials.contains(material)) {
                        nuggetSmeltingBuilder.notConsumable(IntCircuitIngredient.getIntegratedCircuit(0));
                    }
                    nuggetSmeltingBuilder.buildAndRegister();
                }
                if (hasHotIngot) {
                    RecipeMaps.VACUUM_RECIPES.recipeBuilder().input(OrePrefix.ingotHot, metalMaterial).outputs(OreDictUnifier.get(OrePrefix.ingot, metalMaterial)).duration(metalMaterial.blastFurnaceTemperature / 16).buildAndRegister();
                }
                if (metalMaterial.blastFurnaceTemperature <= 1000) {
                    ModHandler.addRCFurnaceRecipe(new UnificationEntry(dustPrefix, metalMaterial), ingotStack, duration);
                    ModHandler.addRCFurnaceRecipe(new UnificationEntry(OrePrefix.nugget, metalMaterial), nuggetStack, Math.max(1, duration / 9));
                }
            }
        }
    } else if (material.hasFlag(MatFlags.GENERATE_PLATE) && !material.hasFlag(EXCLUDE_PLATE_COMPRESSOR_RECIPE)) {
        RecipeMaps.COMPRESSOR_RECIPES.recipeBuilder().input(dustPrefix, material).outputs(OreDictUnifier.get(OrePrefix.plate, material)).buildAndRegister();
    }
}
Also used : IntCircuitIngredient(gregtech.api.recipes.ingredients.IntCircuitIngredient) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) BlastRecipeBuilder(gregtech.api.recipes.builders.BlastRecipeBuilder) ItemStack(net.minecraft.item.ItemStack) CountableIngredient(gregtech.api.recipes.CountableIngredient)

Aggregations

CountableIngredient (gregtech.api.recipes.CountableIngredient)1 BlastRecipeBuilder (gregtech.api.recipes.builders.BlastRecipeBuilder)1 IntCircuitIngredient (gregtech.api.recipes.ingredients.IntCircuitIngredient)1 UnificationEntry (gregtech.api.unification.stack.UnificationEntry)1 ItemStack (net.minecraft.item.ItemStack)1