Search in sources :

Example 61 with UnificationEntry

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

the class OreRecipeHandler method processMetalSmelting.

private static void processMetalSmelting(OrePrefix crushedPrefix, DustMaterial material) {
    DustMaterial smeltingMaterial = material.directSmelting == null ? material : material.directSmelting;
    int amountOfNuggets = (int) Math.floor(9.0 * getPercentOfComponentInMaterial(material, smeltingMaterial));
    if (smeltingMaterial instanceof IngotMaterial) {
        ItemStack ingotStack;
        if (amountOfNuggets == 9) {
            ingotStack = OreDictUnifier.get(OrePrefix.ingot, smeltingMaterial);
        } else {
            ingotStack = OreDictUnifier.get(OrePrefix.nugget, smeltingMaterial, amountOfNuggets);
        }
        if (!ingotStack.isEmpty() && doesMaterialUseNormalFurnace(smeltingMaterial)) {
            ModHandler.addSmeltingRecipe(new UnificationEntry(crushedPrefix, material), ingotStack);
        }
    }
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Example 62 with UnificationEntry

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

the class OreRecipeHandler method processCrushedPurified.

public static void processCrushedPurified(OrePrefix purifiedPrefix, DustMaterial material) {
    ItemStack crushedCentrifugedStack = OreDictUnifier.get(OrePrefix.crushedCentrifuged, material);
    ItemStack dustStack = OreDictUnifier.get(OrePrefix.dustPure, material);
    Material byproductMaterial = GTUtility.selectItemInList(1, material, material.oreByProducts, DustMaterial.class);
    ItemStack byproductStack = OreDictUnifier.get(OrePrefix.dust, byproductMaterial);
    RecipeMaps.FORGE_HAMMER_RECIPES.recipeBuilder().input(purifiedPrefix, material).outputs(dustStack).duration(60).EUt(8).buildAndRegister();
    RecipeMaps.MACERATOR_RECIPES.recipeBuilder().input(purifiedPrefix, material).outputs(dustStack).chancedOutput(byproductStack, 1400, 850).duration(200).EUt(12).buildAndRegister();
    ModHandler.addShapelessRecipe(String.format("purified_ore_to_dust_%s", material), dustStack, 'h', new UnificationEntry(purifiedPrefix, material));
    if (!crushedCentrifugedStack.isEmpty()) {
        RecipeMaps.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder().input(purifiedPrefix, material).outputs(crushedCentrifugedStack, OreDictUnifier.get(OrePrefix.dustTiny, byproductMaterial, 3)).duration((int) (material.getAverageMass() * 20)).EUt(60).buildAndRegister();
    }
    if (material instanceof GemMaterial) {
        ItemStack exquisiteStack = OreDictUnifier.get(OrePrefix.gemExquisite, material);
        ItemStack flawlessStack = OreDictUnifier.get(OrePrefix.gemFlawless, material);
        ItemStack gemStack = OreDictUnifier.get(OrePrefix.gem, material);
        ItemStack flawedStack = OreDictUnifier.get(OrePrefix.gemFlawed, material);
        ItemStack chippedStack = OreDictUnifier.get(OrePrefix.gemChipped, material);
        if (material.hasFlag(GemMaterial.MatFlags.HIGH_SIFTER_OUTPUT)) {
            RecipeMaps.SIFTER_RECIPES.recipeBuilder().input(purifiedPrefix, material).chancedOutput(exquisiteStack, 300, 60).chancedOutput(flawlessStack, 1200, 180).chancedOutput(gemStack, 4500, 540).chancedOutput(flawedStack, 1400, 240).chancedOutput(chippedStack, 2800, 320).chancedOutput(dustStack, 3500, 500).duration(800).EUt(16).buildAndRegister();
        } else {
            RecipeMaps.SIFTER_RECIPES.recipeBuilder().input(purifiedPrefix, material).chancedOutput(exquisiteStack, 100, 30).chancedOutput(flawlessStack, 400, 70).chancedOutput(gemStack, 1500, 300).chancedOutput(flawedStack, 2000, 240).chancedOutput(chippedStack, 4000, 320).chancedOutput(dustStack, 5000, 600).duration(800).EUt(16).buildAndRegister();
        }
    }
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Example 63 with UnificationEntry

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

the class PipeRecipeHandler method processPipeSmall.

private static void processPipeSmall(OrePrefix pipePrefix, IngotMaterial material) {
    ItemStack pipeStack = OreDictUnifier.get(pipePrefix, material);
    RecipeMaps.EXTRUDER_RECIPES.recipeBuilder().input(OrePrefix.ingot, material, 3).notConsumable(MetaItems.SHAPE_EXTRUDER_PIPE_SMALL).outputs(GTUtility.copyAmount(2, pipeStack)).duration((int) (material.getAverageMass() * 2)).EUt(6 * getVoltageMultiplier(material)).buildAndRegister();
    ModHandler.addShapedRecipe(String.format("small_%s_pipe", material.toString()), GTUtility.copyAmount(4, pipeStack), "XXX", "h f", "XXX", 'X', new UnificationEntry(OrePrefix.plate, material));
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Example 64 with UnificationEntry

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

the class ToolRecipeHandler method registerPowerUnitRecipes.

public static void registerPowerUnitRecipes() {
    for (int i = 0; i < powerUnitItems.length; i++) {
        for (MetaValueItem batteryItem : batteryItems[i]) {
            ItemStack batteryStack = batteryItem.getStackForm();
            long maxCharge = batteryStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null).getMaxCharge();
            ItemStack powerUnitStack = powerUnitItems[i].getMaxChargeOverrideStack(maxCharge);
            String recipeName = String.format("%s_%s", powerUnitItems[i].unlocalizedName, batteryItem.unlocalizedName);
            ModHandler.addShapedEnergyTransferRecipe(recipeName, powerUnitStack, Ingredient.fromStacks(batteryStack), false, "S  ", "GMG", "PBP", 'M', motorItems[i].getStackForm(), 'S', new UnificationEntry(OrePrefix.screw, baseMaterials[i]), 'P', new UnificationEntry(OrePrefix.plate, baseMaterials[i]), 'G', new UnificationEntry(OrePrefix.gearSmall, baseMaterials[i]), 'B', batteryStack);
        }
    }
    for (MetaValueItem batteryItem : batteryItems[2]) {
        ItemStack batteryStack = batteryItem.getStackForm();
        long maxCharge = batteryStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null).getMaxCharge();
        ItemStack hammerBaseStack = MetaItems.JACKHAMMER_BASE.getMaxChargeOverrideStack(maxCharge);
        String recipeName = String.format("jackhammer_base_%s", batteryItem.unlocalizedName);
        ModHandler.addShapedEnergyTransferRecipe(recipeName, hammerBaseStack, Ingredient.fromStacks(batteryStack), false, "S  ", "PRP", "MPB", 'M', MetaItems.ELECTRIC_PISTON_HV.getStackForm(), 'S', new UnificationEntry(OrePrefix.screw, Materials.Titanium), 'P', new UnificationEntry(OrePrefix.plateDense, Materials.Titanium), 'R', new UnificationEntry(OrePrefix.spring, Materials.Titanium), 'B', batteryStack);
    }
}
Also used : MetaValueItem(gregtech.api.items.metaitem.MetaItem.MetaValueItem) UnificationEntry(gregtech.api.unification.stack.UnificationEntry) ItemStack(net.minecraft.item.ItemStack)

Example 65 with UnificationEntry

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

the class CraftingRecipeLoader method registerFacadeRecipe.

private static void registerFacadeRecipe(Material material, int facadeAmount) {
    OreIngredient ingredient = new OreIngredient(new UnificationEntry(OrePrefix.plate, material).toString());
    ForgeRegistries.RECIPES.register(new FacadeRecipe(null, ingredient, facadeAmount).setRegistryName("facade_" + material));
}
Also used : UnificationEntry(gregtech.api.unification.stack.UnificationEntry) OreIngredient(net.minecraftforge.oredict.OreIngredient) FacadeRecipe(gregtech.common.crafting.FacadeRecipe)

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