Search in sources :

Example 11 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class OreRecipeHandler method processOre.

public static void processOre(OrePrefix orePrefix, DustMaterial material) {
    DustMaterial byproductMaterial = GTUtility.selectItemInList(0, material, material.oreByProducts, DustMaterial.class);
    ItemStack byproductStack = OreDictUnifier.get(OrePrefix.dust, byproductMaterial);
    ItemStack crushedStack = OreDictUnifier.get(OrePrefix.crushed, material.crushedInto);
    ItemStack ingotStack;
    DustMaterial smeltingMaterial = material.directSmelting == null ? material : material.directSmelting;
    double amountOfCrushedOre = material.oreMultiplier / getPercentOfComponentInMaterial(material, smeltingMaterial);
    if (smeltingMaterial instanceof IngotMaterial) {
        ingotStack = OreDictUnifier.get(OrePrefix.ingot, smeltingMaterial);
    } else if (smeltingMaterial instanceof GemMaterial) {
        ingotStack = OreDictUnifier.get(OrePrefix.gem, smeltingMaterial);
    } else {
        ingotStack = OreDictUnifier.get(OrePrefix.dust, smeltingMaterial);
    }
    ingotStack.setCount(ingotStack.getCount() * material.oreMultiplier);
    crushedStack.setCount(crushedStack.getCount() * material.oreMultiplier);
    if (!crushedStack.isEmpty()) {
        RecipeMaps.FORGE_HAMMER_RECIPES.recipeBuilder().input(orePrefix, material).outputs(GTUtility.copyAmount((int) Math.ceil(amountOfCrushedOre), crushedStack)).duration(100).EUt(6).buildAndRegister();
        RecipeBuilder<?> builder = RecipeMaps.MACERATOR_RECIPES.recipeBuilder().input(orePrefix, material).outputs(GTUtility.copyAmount((int) Math.round(amountOfCrushedOre) * 2, crushedStack)).chancedOutput(byproductStack, 1400, 850).duration(400).EUt(12);
        for (MaterialStack secondaryMaterial : orePrefix.secondaryMaterials) {
            if (secondaryMaterial.material instanceof DustMaterial) {
                ItemStack dustStack = OreDictUnifier.getDust(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) && !material.disableDirectSmelting) {
        ModHandler.addSmeltingRecipe(new UnificationEntry(orePrefix, material), ingotStack);
    }
}
Also used : MaterialStack(gregtech.api.unification.stack.MaterialStack) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Example 12 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class OreRecipeHandler method processCrushedOre.

public static void processCrushedOre(OrePrefix crushedPrefix, DustMaterial material) {
    ItemStack impureDustStack = OreDictUnifier.get(OrePrefix.dustImpure, material);
    DustMaterial byproductMaterial = GTUtility.selectItemInList(0, material, material.oreByProducts, DustMaterial.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(60).EUt(8).buildAndRegister();
    RecipeMaps.MACERATOR_RECIPES.recipeBuilder().input(crushedPrefix, material).outputs(impureDustStack).duration(200).EUt(12).chancedOutput(OreDictUnifier.get(OrePrefix.dust, byproductMaterial, material.byProductMultiplier), 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).fluidInputs(ModHandler.getWater(1000)).outputs(crushedPurifiedOre, OreDictUnifier.get(OrePrefix.dustTiny, byproductMaterial, 3), OreDictUnifier.get(OrePrefix.dust, Materials.Stone)).buildAndRegister();
    RecipeMaps.ORE_WASHER_RECIPES.recipeBuilder().input(crushedPrefix, material).fluidInputs(ModHandler.getDistilledWater(1000)).outputs(crushedPurifiedOre, OreDictUnifier.get(OrePrefix.dustTiny, byproductMaterial, 3), OreDictUnifier.get(OrePrefix.dust, Materials.Stone)).duration(300).buildAndRegister();
    RecipeMaps.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder().input(crushedPrefix, material).duration((int) material.getAverageMass() * 20).outputs(crushedCentrifugedOre, OreDictUnifier.get(OrePrefix.dustTiny, byproductMaterial, material.byProductMultiplier * 3), OreDictUnifier.get(OrePrefix.dust, Materials.Stone)).buildAndRegister();
    if (material.washedIn != null) {
        DustMaterial washingByproduct = GTUtility.selectItemInList(3, material, material.oreByProducts, DustMaterial.class);
        RecipeMaps.CHEMICAL_BATH_RECIPES.recipeBuilder().input(crushedPrefix, material).fluidInputs(material.washedIn.getFluid(material.washedIn == Materials.SodiumPersulfate ? 100 : 1000)).outputs(crushedPurifiedOre).chancedOutput(OreDictUnifier.get(OrePrefix.dust, washingByproduct, material.byProductMultiplier), 7000, 580).chancedOutput(OreDictUnifier.get(OrePrefix.dust, Materials.Stone), 4000, 650).duration(800).EUt(8).buildAndRegister();
    }
    ModHandler.addShapelessRecipe(String.format("crushed_ore_to_dust_%s", material), impureDustStack, 'h', new UnificationEntry(crushedPrefix, material));
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Example 13 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class PolarizingRecipeHandler method processPolarizing.

public static void processPolarizing(OrePrefix polarizingPrefix, IngotMaterial material) {
    if (material.magneticMaterial != null && polarizingPrefix.doGenerateItem(material.magneticMaterial)) {
        ItemStack magneticStack = OreDictUnifier.get(polarizingPrefix, material.magneticMaterial);
        // polarizing
        RecipeMaps.POLARIZER_RECIPES.recipeBuilder().input(polarizingPrefix, material).outputs(magneticStack).duration(16).EUt(16).buildAndRegister();
        ModHandler.addSmeltingRecipe(new UnificationEntry(polarizingPrefix, material.magneticMaterial), // de-magnetizing
        OreDictUnifier.get(polarizingPrefix, material));
    }
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Example 14 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class WireRecipeHandler method processWireSingle.

public static void processWireSingle(OrePrefix wirePrefix, IngotMaterial material) {
    RecipeMaps.EXTRUDER_RECIPES.recipeBuilder().input(OrePrefix.ingot, material).notConsumable(MetaItems.SHAPE_EXTRUDER_WIRE).outputs(OreDictUnifier.get(OrePrefix.wireGtSingle, material, 2)).duration((int) material.getAverageMass() * 2).EUt(6 * getVoltageMultiplier(material)).buildAndRegister();
    RecipeMaps.WIREMILL_RECIPES.recipeBuilder().input(OrePrefix.ingot, material).outputs(OreDictUnifier.get(OrePrefix.wireGtSingle, material, 2)).duration((int) material.getAverageMass()).EUt(getVoltageMultiplier(material)).buildAndRegister();
    if (!material.hasFlag(MatFlags.NO_WORKING)) {
        ModHandler.addShapedRecipe(String.format("%s_wire_single", material), OreDictUnifier.get(OrePrefix.wireGtSingle, material), "Xx", 'X', new UnificationEntry(OrePrefix.plate, material));
    }
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry)

Example 15 with UnificationEntry

use of gregtech.api.unification.stack.UnificationEntry in project GregTech by GregTechCE.

the class WireRecipeHandler method generateWireRecipe.

public static void generateWireRecipe(OrePrefix wirePrefix, IngotMaterial material) {
    int cableAmount = (int) (wirePrefix.materialAmount * 2 / M);
    OrePrefix cablePrefix = OrePrefix.valueOf("cable" + wirePrefix.name().substring(4));
    ItemStack cableStack = OreDictUnifier.get(cablePrefix, material);
    if (material.cableProperties == null)
        return;
    if (isPaperInsulatedCable(material)) {
        if (cableAmount <= 7) {
            Object[] ingredients = new Object[2 + cableAmount];
            ingredients[0] = new UnificationEntry(wirePrefix, material);
            ingredients[ingredients.length - 1] = OreDictNames.string;
            for (int i = 1; i < ingredients.length - 1; i++) {
                ingredients[i] = new ItemStack(Blocks.CARPET, 1, EnumDyeColor.BLACK.getMetadata());
            }
            ModHandler.addShapelessRecipe(String.format("%s_cable_%d", material, cableAmount), cableStack, ingredients);
        }
    }
    if (isPaperInsulatedCable(material)) {
        ItemStack carpetStack = new ItemStack(Blocks.CARPET, cableAmount, EnumDyeColor.BLACK.getMetadata());
        RecipeMaps.PACKER_RECIPES.recipeBuilder().input(wirePrefix, material).inputs(carpetStack).outputs(cableStack).duration(100).EUt(8).buildAndRegister();
    }
    for (FluidMaterial insulationMaterial : INSULATION_MATERIALS.keySet()) {
        int cableTier = GTUtility.getTierByVoltage(material.cableProperties.voltage);
        int materialAmount = getMaterialAmount(cableTier, INSULATION_MATERIALS.get(insulationMaterial));
        if (materialAmount == -1)
            continue;
        if (wirePrefix != OrePrefix.wireGtSingle) {
            RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().input(OrePrefix.wireGtSingle, material, cableAmount).circuitMeta(24 + ArrayUtils.indexOf(WIRE_DOUBLING_ORDER, wirePrefix)).fluidInputs(insulationMaterial.getFluid(materialAmount * cableAmount)).outputs(cableStack).duration(150).EUt(8).buildAndRegister();
        }
        RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().input(wirePrefix, material).circuitMeta(24).fluidInputs(insulationMaterial.getFluid(materialAmount * cableAmount)).outputs(cableStack).duration(150).EUt(8).buildAndRegister();
    }
}
Also used : FluidMaterial(gregtech.api.unification.material.type.FluidMaterial) OrePrefix(gregtech.api.unification.ore.OrePrefix) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Aggregations

UnificationEntry (gregtech.api.unification.stack.UnificationEntry)65 ItemStack (net.minecraft.item.ItemStack)50 OrePrefix (gregtech.api.unification.ore.OrePrefix)11 Material (gregtech.api.unification.material.type.Material)10 SimpleItemStack (gregtech.api.unification.stack.SimpleItemStack)10 MaterialStack (gregtech.api.unification.stack.MaterialStack)8 IntCircuitIngredient (gregtech.api.recipes.ingredients.IntCircuitIngredient)6 SolidMaterial (gregtech.api.unification.material.type.SolidMaterial)6 MetaValueItem (gregtech.api.items.metaitem.MetaItem.MetaValueItem)5 CountableIngredient (gregtech.api.recipes.CountableIngredient)5 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)5 ItemMaterialInfo (gregtech.api.unification.stack.ItemMaterialInfo)4 Nullable (javax.annotation.Nullable)4 CaseFormat (com.google.common.base.CaseFormat)3 Joiner (com.google.common.base.Joiner)3 ImmutableList (com.google.common.collect.ImmutableList)3 GTValues (gregtech.api.GTValues)3 M (gregtech.api.GTValues.M)3 ToolMetaItem (gregtech.api.items.toolitem.ToolMetaItem)3 ModHandler (gregtech.api.recipes.ModHandler)3