Search in sources :

Example 41 with Material

use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.

the class DecompositionRecipeHandler method runRecipeGeneration.

public static void runRecipeGeneration() {
    for (Material material : GregTechAPI.MATERIAL_REGISTRY) {
        OrePrefix prefix = material.hasProperty(PropertyKey.DUST) ? OrePrefix.dust : null;
        processDecomposition(prefix, material);
    }
}
Also used : OrePrefix(gregtech.api.unification.ore.OrePrefix) Material(gregtech.api.unification.material.Material)

Example 42 with Material

use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.

the class OreRecipeHandler method processOre.

public static void processOre(OrePrefix orePrefix, Material material, OreProperty property) {
    Material byproductMaterial = GTUtility.selectItemInList(0, material, property.getOreByProducts(), Material.class);
    ItemStack byproductStack = OreDictUnifier.get(OrePrefix.gem, byproductMaterial);
    if (byproductStack.isEmpty())
        byproductStack = OreDictUnifier.get(OrePrefix.dust, byproductMaterial);
    ItemStack crushedStack = OreDictUnifier.get(OrePrefix.crushed, material);
    ItemStack ingotStack;
    Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : property.getDirectSmeltResult();
    double amountOfCrushedOre = property.getOreMultiplier();
    if (smeltingMaterial.hasProperty(PropertyKey.INGOT)) {
        ingotStack = OreDictUnifier.get(OrePrefix.ingot, smeltingMaterial);
    } else if (smeltingMaterial.hasProperty(PropertyKey.GEM)) {
        ingotStack = OreDictUnifier.get(OrePrefix.gem, smeltingMaterial);
    } else {
        ingotStack = OreDictUnifier.get(OrePrefix.dust, smeltingMaterial);
    }
    int oreTypeMultiplier = orePrefix == OrePrefix.oreNetherrack || orePrefix == OrePrefix.oreEndstone ? 2 : 1;
    ingotStack.setCount(ingotStack.getCount() * property.getOreMultiplier() * oreTypeMultiplier);
    crushedStack.setCount(crushedStack.getCount() * property.getOreMultiplier());
    if (!crushedStack.isEmpty()) {
        RecipeBuilder<?> builder = RecipeMaps.FORGE_HAMMER_RECIPES.recipeBuilder().input(orePrefix, material).duration(10).EUt(16);
        if (material.hasProperty(PropertyKey.GEM) && !OrePrefix.gem.isIgnored(material)) {
            builder.outputs(GTUtility.copyAmount((int) Math.ceil(amountOfCrushedOre) * oreTypeMultiplier, OreDictUnifier.get(OrePrefix.gem, material, crushedStack.getCount())));
        } else {
            builder.outputs(GTUtility.copyAmount((int) Math.ceil(amountOfCrushedOre) * oreTypeMultiplier, crushedStack));
        }
        builder.buildAndRegister();
        builder = RecipeMaps.MACERATOR_RECIPES.recipeBuilder().input(orePrefix, material).outputs(GTUtility.copyAmount((int) Math.round(amountOfCrushedOre) * 2 * oreTypeMultiplier, crushedStack)).chancedOutput(byproductStack, 1400, 850).duration(400);
        for (MaterialStack secondaryMaterial : orePrefix.secondaryMaterials) {
            if (secondaryMaterial.material.hasProperty(PropertyKey.DUST)) {
                ItemStack dustStack = OreDictUnifier.getGem(secondaryMaterial);
                builder.chancedOutput(dustStack, 6700, 800);
            }
        }
        builder.buildAndRegister();
    }
    // do not try to add smelting recipes for materials which require blast furnace
    if (!ingotStack.isEmpty() && doesMaterialUseNormalFurnace(smeltingMaterial)) {
        ModHandler.addSmeltingRecipe(new UnificationEntry(orePrefix, material), ingotStack, 0.5f);
    }
}
Also used : MaterialStack(gregtech.api.unification.stack.MaterialStack) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) Material(gregtech.api.unification.material.Material) ItemStack(net.minecraft.item.ItemStack)

Example 43 with Material

use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.

the class OreRecipeHandler method processCrushedCentrifuged.

public static void processCrushedCentrifuged(OrePrefix centrifugedPrefix, Material material, OreProperty property) {
    ItemStack dustStack = OreDictUnifier.get(OrePrefix.dust, material);
    ItemStack byproductStack = OreDictUnifier.get(OrePrefix.dust, GTUtility.selectItemInList(2, material, property.getOreByProducts(), Material.class), 1);
    RecipeMaps.FORGE_HAMMER_RECIPES.recipeBuilder().input(centrifugedPrefix, material).outputs(dustStack).duration(10).EUt(16).buildAndRegister();
    RecipeMaps.MACERATOR_RECIPES.recipeBuilder().input(centrifugedPrefix, material).outputs(dustStack).chancedOutput(byproductStack, 1400, 850).duration(400).buildAndRegister();
    ModHandler.addShapelessRecipe(String.format("centrifuged_ore_to_dust_%s", material), dustStack, 'h', new UnificationEntry(centrifugedPrefix, material));
    processMetalSmelting(centrifugedPrefix, material, property);
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) Material(gregtech.api.unification.material.Material) ItemStack(net.minecraft.item.ItemStack)

Example 44 with Material

use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.

the class OreRecipeHandler method processCrushedOre.

public static void processCrushedOre(OrePrefix crushedPrefix, Material material, OreProperty property) {
    ItemStack impureDustStack = OreDictUnifier.get(OrePrefix.dustImpure, material);
    Material byproductMaterial = GTUtility.selectItemInList(0, material, property.getOreByProducts(), Material.class);
    // fallback for dirtyGravel, shard & clump
    if (impureDustStack.isEmpty()) {
        impureDustStack = GTUtility.copy(OreDictUnifier.get(OrePrefix.dirtyGravel, material), OreDictUnifier.get(OrePrefix.shard, material), OreDictUnifier.get(OrePrefix.clump, material), OreDictUnifier.get(OrePrefix.dust, material));
    }
    RecipeMaps.FORGE_HAMMER_RECIPES.recipeBuilder().input(crushedPrefix, material).outputs(impureDustStack).duration(10).EUt(16).buildAndRegister();
    RecipeMaps.MACERATOR_RECIPES.recipeBuilder().input(crushedPrefix, material).outputs(impureDustStack).duration(400).chancedOutput(OreDictUnifier.get(OrePrefix.dust, byproductMaterial, property.getByProductMultiplier()), 1400, 850).buildAndRegister();
    ItemStack crushedPurifiedOre = GTUtility.copy(OreDictUnifier.get(OrePrefix.crushedPurified, material), OreDictUnifier.get(OrePrefix.dust, material));
    ItemStack crushedCentrifugedOre = GTUtility.copy(OreDictUnifier.get(OrePrefix.crushedCentrifuged, material), OreDictUnifier.get(OrePrefix.dust, material));
    RecipeMaps.ORE_WASHER_RECIPES.recipeBuilder().input(crushedPrefix, material).notConsumable(new IntCircuitIngredient(2)).fluidInputs(Materials.Water.getFluid(100)).outputs(crushedPurifiedOre).duration(8).EUt(4).buildAndRegister();
    RecipeMaps.ORE_WASHER_RECIPES.recipeBuilder().input(crushedPrefix, material).fluidInputs(Materials.Water.getFluid(1000)).notConsumable(new IntCircuitIngredient(1)).outputs(crushedPurifiedOre, OreDictUnifier.get(OrePrefix.dustTiny, byproductMaterial, 3), OreDictUnifier.get(OrePrefix.dust, Materials.Stone)).buildAndRegister();
    RecipeMaps.ORE_WASHER_RECIPES.recipeBuilder().input(crushedPrefix, material).fluidInputs(Materials.DistilledWater.getFluid(100)).outputs(crushedPurifiedOre, OreDictUnifier.get(OrePrefix.dustTiny, byproductMaterial, 3), OreDictUnifier.get(OrePrefix.dust, Materials.Stone)).duration(200).buildAndRegister();
    RecipeMaps.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder().input(crushedPrefix, material).outputs(crushedCentrifugedOre, OreDictUnifier.get(OrePrefix.dustTiny, GTUtility.selectItemInList(1, material, property.getOreByProducts(), Material.class), property.getByProductMultiplier() * 3), OreDictUnifier.get(OrePrefix.dust, Materials.Stone)).buildAndRegister();
    if (property.getWashedIn().getKey() != null) {
        Material washingByproduct = GTUtility.selectItemInList(3, material, property.getOreByProducts(), Material.class);
        Pair<Material, Integer> washedInTuple = property.getWashedIn();
        RecipeMaps.CHEMICAL_BATH_RECIPES.recipeBuilder().input(crushedPrefix, material).fluidInputs(washedInTuple.getKey().getFluid(washedInTuple.getValue())).outputs(crushedPurifiedOre).chancedOutput(OreDictUnifier.get(OrePrefix.dust, washingByproduct, property.getByProductMultiplier()), 7000, 580).chancedOutput(OreDictUnifier.get(OrePrefix.dust, Materials.Stone), 4000, 650).duration(200).EUt(VA[LV]).buildAndRegister();
    }
    ModHandler.addShapelessRecipe(String.format("crushed_ore_to_dust_%s", material), impureDustStack, 'h', new UnificationEntry(crushedPrefix, material));
    processMetalSmelting(crushedPrefix, material, property);
}
Also used : IntCircuitIngredient(gregtech.api.recipes.ingredients.IntCircuitIngredient) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) Material(gregtech.api.unification.material.Material) ItemStack(net.minecraft.item.ItemStack)

Example 45 with Material

use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.

the class OreRecipeHandler method processPureDust.

public static void processPureDust(OrePrefix purePrefix, Material material, OreProperty property) {
    Material byproductMaterial = GTUtility.selectItemInList(1, material, property.getOreByProducts(), Material.class);
    ItemStack dustStack = OreDictUnifier.get(OrePrefix.dust, material);
    if (property.getSeparatedInto() != null && !property.getSeparatedInto().isEmpty()) {
        List<Material> separatedMaterial = property.getSeparatedInto();
        ItemStack separatedStack1 = OreDictUnifier.get(OrePrefix.dustSmall, separatedMaterial.get(0));
        OrePrefix prefix = (separatedMaterial.get(separatedMaterial.size() - 1).getBlastTemperature() == 0 && separatedMaterial.get(separatedMaterial.size() - 1).hasProperty(PropertyKey.INGOT)) ? OrePrefix.nugget : OrePrefix.dustSmall;
        ItemStack separatedStack2 = OreDictUnifier.get(prefix, separatedMaterial.get(separatedMaterial.size() - 1), prefix == OrePrefix.nugget ? 2 : 1);
        RecipeMaps.ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder().input(purePrefix, material).outputs(dustStack).chancedOutput(separatedStack1, 4000, 850).chancedOutput(separatedStack2, 2000, 600).duration(200).EUt(24).buildAndRegister();
    }
    if (dustStack.isEmpty()) {
        // fallback for reduced & cleanGravel
        dustStack = GTUtility.copy(OreDictUnifier.get(OrePrefix.reduced, material), OreDictUnifier.get(OrePrefix.cleanGravel, material));
    }
    RecipeMaps.CENTRIFUGE_RECIPES.recipeBuilder().input(purePrefix, material).outputs(dustStack, OreDictUnifier.get(OrePrefix.dustTiny, byproductMaterial)).duration(100).EUt(5).buildAndRegister();
    RecipeMaps.ORE_WASHER_RECIPES.recipeBuilder().input(purePrefix, material).notConsumable(new IntCircuitIngredient(2)).fluidInputs(Materials.Water.getFluid(100)).outputs(dustStack).duration(8).EUt(4).buildAndRegister();
    processMetalSmelting(purePrefix, material, property);
}
Also used : IntCircuitIngredient(gregtech.api.recipes.ingredients.IntCircuitIngredient) OrePrefix(gregtech.api.unification.ore.OrePrefix) Material(gregtech.api.unification.material.Material) ItemStack(net.minecraft.item.ItemStack)

Aggregations

Material (gregtech.api.unification.material.Material)76 ItemStack (net.minecraft.item.ItemStack)31 UnificationEntry (gregtech.api.unification.stack.UnificationEntry)19 OrePrefix (gregtech.api.unification.ore.OrePrefix)13 MaterialStack (gregtech.api.unification.stack.MaterialStack)12 Nonnull (javax.annotation.Nonnull)10 PropertyKey (gregtech.api.unification.material.properties.PropertyKey)9 Block (net.minecraft.block.Block)8 IBlockState (net.minecraft.block.state.IBlockState)8 GTValues (gregtech.api.GTValues)7 Collectors (java.util.stream.Collectors)7 Nullable (javax.annotation.Nullable)7 Materials (gregtech.api.unification.material.Materials)6 DustProperty (gregtech.api.unification.material.properties.DustProperty)6 ToolProperty (gregtech.api.unification.material.properties.ToolProperty)6 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)6 GregTechAPI (gregtech.api.GregTechAPI)5 OreDictUnifier (gregtech.api.unification.OreDictUnifier)5 MarkerMaterial (gregtech.api.unification.material.MarkerMaterial)5 ItemMaterialInfo (gregtech.api.unification.stack.ItemMaterialInfo)5