Search in sources :

Example 51 with UnificationEntry

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

the class MaterialRecipeHandler method processNugget.

public static void processNugget(OrePrefix orePrefix, SolidMaterial material) {
    ItemStack nuggetStack = OreDictUnifier.get(orePrefix, material);
    if (material instanceof IngotMaterial) {
        ItemStack ingotStack = OreDictUnifier.get(OrePrefix.ingot, material);
        ModHandler.addShapelessRecipe(String.format("nugget_disassembling_%s", material.toString()), GTUtility.copyAmount(9, nuggetStack), new UnificationEntry(OrePrefix.ingot, material));
        ModHandler.addShapedRecipe(String.format("nugget_assembling_%s", material.toString()), ingotStack, "XXX", "XXX", "XXX", 'X', new UnificationEntry(orePrefix, material));
        RecipeMaps.UNPACKER_RECIPES.recipeBuilder().input(OrePrefix.ingot, material).inputs(new CountableIngredient(new IntCircuitIngredient(1), 0)).outputs(GTUtility.copyAmount(9, nuggetStack)).buildAndRegister();
        RecipeMaps.PACKER_RECIPES.recipeBuilder().input(orePrefix, material, 9).inputs(new CountableIngredient(new IntCircuitIngredient(1), 0)).outputs(ingotStack).buildAndRegister();
        if (material.shouldGenerateFluid()) {
            RecipeMaps.FLUID_SOLIDFICATION_RECIPES.recipeBuilder().notConsumable(MetaItems.SHAPE_MOLD_NUGGET).fluidInputs(material.getFluid(L)).outputs(OreDictUnifier.get(orePrefix, material, 9)).duration((int) material.getAverageMass()).EUt(8).buildAndRegister();
        }
    } else if (material instanceof GemMaterial) {
        ItemStack gemStack = OreDictUnifier.get(OrePrefix.gem, material);
        ModHandler.addShapelessRecipe(String.format("nugget_disassembling_%s", material.toString()), GTUtility.copyAmount(9, nuggetStack), new UnificationEntry(OrePrefix.gem, material));
        ModHandler.addShapedRecipe(String.format("nugget_assembling_%s", material.toString()), gemStack, "XXX", "XXX", "XXX", 'X', new UnificationEntry(orePrefix, material));
    }
}
Also used : IntCircuitIngredient(gregtech.api.recipes.ingredients.IntCircuitIngredient) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack) CountableIngredient(gregtech.api.recipes.CountableIngredient)

Example 52 with UnificationEntry

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

the class MaterialRecipeHandler method processBlock.

public static void processBlock(OrePrefix blockPrefix, DustMaterial material) {
    ItemStack blockStack = OreDictUnifier.get(blockPrefix, material);
    long materialAmount = blockPrefix.getMaterialAmount(material);
    if (material.shouldGenerateFluid()) {
        RecipeMaps.FLUID_SOLIDFICATION_RECIPES.recipeBuilder().notConsumable(MetaItems.SHAPE_MOLD_BLOCK).fluidInputs(material.getFluid((int) (materialAmount * L / M))).outputs(blockStack).duration((int) material.getAverageMass()).EUt(8).buildAndRegister();
    }
    if (material.hasFlag(MatFlags.GENERATE_PLATE)) {
        ItemStack plateStack = OreDictUnifier.get(OrePrefix.plate, material);
        RecipeMaps.CUTTER_RECIPES.recipeBuilder().input(blockPrefix, material).outputs(GTUtility.copyAmount((int) (materialAmount / M), plateStack)).duration((int) (material.getAverageMass() * 8L)).EUt(30).buildAndRegister();
    }
    UnificationEntry blockEntry;
    if (material instanceof GemMaterial) {
        blockEntry = new UnificationEntry(OrePrefix.gem, material);
    } else if (material instanceof IngotMaterial) {
        blockEntry = new UnificationEntry(OrePrefix.ingot, material);
    } else {
        blockEntry = new UnificationEntry(OrePrefix.dust, material);
    }
    ArrayList<Object> result = new ArrayList<>();
    for (int index = 0; index < materialAmount / M; index++) {
        result.add(blockEntry);
    }
    // do not allow hand crafting or uncrafting, extruding or alloy smelting of blacklisted blocks
    if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_RECIPES)) {
        // do not allow hand crafting or uncrafting of blacklisted blocks
        if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES)) {
            ModHandler.addShapelessRecipe(String.format("block_compress_%s", material.toString()), blockStack, result.toArray());
            ModHandler.addShapelessRecipe(String.format("block_decompress_%s", material.toString()), GTUtility.copyAmount((int) (materialAmount / M), OreDictUnifier.get(blockEntry)), new UnificationEntry(blockPrefix, material));
        }
        if (material instanceof IngotMaterial) {
            int voltageMultiplier = getVoltageMultiplier(material);
            RecipeMaps.EXTRUDER_RECIPES.recipeBuilder().input(OrePrefix.ingot, material, (int) (materialAmount / M)).notConsumable(MetaItems.SHAPE_EXTRUDER_BLOCK).outputs(blockStack).duration(10).EUt(8 * voltageMultiplier).buildAndRegister();
            RecipeMaps.ALLOY_SMELTER_RECIPES.recipeBuilder().input(OrePrefix.ingot, material, (int) (materialAmount / M)).notConsumable(MetaItems.SHAPE_MOLD_BLOCK).outputs(blockStack).duration(5).EUt(4 * voltageMultiplier).buildAndRegister();
        }
    }
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Example 53 with UnificationEntry

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

the class PartsRecipeHandler method processTurbine.

public static void processTurbine(OrePrefix toolPrefix, IngotMaterial material) {
    ItemStack rotorStack = MetaItems.TURBINE_ROTOR.getStackForm();
    // noinspection ConstantConditions
    TurbineRotorBehavior.getInstanceFor(rotorStack).setPartMaterial(rotorStack, material);
    RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().input(OrePrefix.turbineBlade, material, 8).input(OrePrefix.stickLong, Materials.Titanium).outputs(rotorStack).duration(200).EUt(400).buildAndRegister();
    RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder().input(OrePrefix.plate, material, 5).input(OrePrefix.screw, material, 2).outputs(OreDictUnifier.get(toolPrefix, material)).duration(20).EUt(256).circuitMeta(10).buildAndRegister();
    ModHandler.addShapedRecipe(String.format("turbine_blade_%s", material), OreDictUnifier.get(toolPrefix, material), "PPP", "SPS", "fPd", 'P', new UnificationEntry(OrePrefix.plate, material), 'S', new UnificationEntry(OrePrefix.screw, material));
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Example 54 with UnificationEntry

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

the class PartsRecipeHandler method processRotor.

public static void processRotor(OrePrefix rotorPrefix, SolidMaterial material) {
    ItemStack stack = OreDictUnifier.get(rotorPrefix, material);
    ModHandler.addShapedRecipe(String.format("rotor_%s", material.toString()), stack, "PdP", " R ", "PSP", 'P', new UnificationEntry(OrePrefix.plate, material), 'R', new UnificationEntry(OrePrefix.ring, material), 'S', new UnificationEntry(OrePrefix.screw, material));
    if (material.shouldGenerateFluid()) {
        RecipeMaps.FLUID_SOLIDFICATION_RECIPES.recipeBuilder().notConsumable(MetaItems.SHAPE_MOLD_ROTOR).fluidInputs(material.getFluid(L * 4)).outputs(OreDictUnifier.get(rotorPrefix, material)).duration(120).EUt(20).buildAndRegister();
    }
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Example 55 with UnificationEntry

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

the class PartsRecipeHandler method processLongStick.

public static void processLongStick(OrePrefix longStickPrefix, DustMaterial material) {
    ItemStack stack = OreDictUnifier.get(longStickPrefix, material);
    ItemStack stickStack = OreDictUnifier.get(OrePrefix.stick, material);
    RecipeMaps.CUTTER_RECIPES.recipeBuilder().input(longStickPrefix, material).outputs(GTUtility.copyAmount(2, stickStack)).duration((int) Math.max(material.getAverageMass(), 1L)).EUt(4).buildAndRegister();
    ModHandler.addShapedRecipe(String.format("stick_long_%s", material.toString()), GTUtility.copyAmount(2, stickStack), "s", "X", 'X', new UnificationEntry(OrePrefix.stickLong, material));
    ModHandler.addShapedRecipe(String.format("stick_long_gem_flawless_%s", material.toString()), stickStack, "sf", "G ", 'G', new UnificationEntry(OrePrefix.gemFlawless, material));
    ModHandler.addShapedRecipe(String.format("stick_long_gem_exquisite_%s", material.toString()), GTUtility.copyAmount(2, stickStack), "sf", "G ", 'G', new UnificationEntry(OrePrefix.gemExquisite, material));
    if (material.hasFlag(GENERATE_SPRING)) {
        RecipeMaps.BENDER_RECIPES.recipeBuilder().input(longStickPrefix, material).outputs(OreDictUnifier.get(OrePrefix.spring, material)).circuitMeta(1).duration(200).EUt(16).buildAndRegister();
    }
    ModHandler.addShapedRecipe(String.format("stick_long_stick_%s", material.toString()), stack, "ShS", 'S', new UnificationEntry(OrePrefix.stick, material));
    RecipeMaps.FORGE_HAMMER_RECIPES.recipeBuilder().input(OrePrefix.stick, material, 2).outputs(stack).duration((int) Math.max(material.getAverageMass(), 1L)).EUt(16).buildAndRegister();
}
Also used : 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