aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MetalRecipe.java
blob: ce17a8724c68da5ea162f31d785d6ce68b08df7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package gtPlusPlus.xmod.gregtech.loaders;

import static gregtech.api.recipe.RecipeMaps.compressorRecipes;
import static gregtech.api.recipe.RecipeMaps.cutterRecipes;
import static gregtech.api.recipe.RecipeMaps.hammerRecipes;
import static gregtech.api.recipe.RecipeMaps.latheRecipes;
import static gregtech.api.recipe.RecipeMaps.vacuumFreezerRecipes;
import static gregtech.api.util.GT_RecipeBuilder.SECONDS;

import java.util.HashSet;
import java.util.Set;

import gregtech.api.enums.GT_Values;
import gtPlusPlus.api.interfaces.RunnableWithInfo;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialGenerator;
import gtPlusPlus.core.util.minecraft.ItemUtils;

public class RecipeGen_MetalRecipe extends RecipeGen_Base {

    public static final Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<>();

    static {
        MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap);
    }

    public RecipeGen_MetalRecipe(final Material M) {
        this.toGenerate = M;
        mRecipeGenMap.add(this);
    }

    @Override
    public void run() {
        generateRecipes(this.toGenerate);
    }

    private void generateRecipes(final Material material) {

        Logger.WARNING("Generating Metal recipes for " + material.getLocalizedName());
        if (ItemUtils.checkForInvalidItems(material.getIngot(1))
            && ItemUtils.checkForInvalidItems(material.getBlock(1))) {

            GT_Values.RA.stdBuilder()
                .itemInputs(material.getIngot(9))
                .itemOutputs(material.getBlock(1))
                .duration(15 * SECONDS)
                .eut(2)
                .addTo(compressorRecipes);
            Logger.WARNING("Compress Block Recipe: " + material.getLocalizedName() + " - Success");

        }

        if (ItemUtils.checkForInvalidItems(material.getIngot(1))
            && ItemUtils.checkForInvalidItems(material.getRod(1))) {
            GT_Values.RA.stdBuilder()
                .itemInputs(material.getIngot(1))
                .itemOutputs(material.getRod(1), material.getSmallDust(2))
                .duration(Math.max(material.getMass() / 8L, 1L))
                .eut(material.vVoltageMultiplier)
                .addTo(latheRecipes);

            Logger.WARNING("Lathe Rod Recipe: " + material.getLocalizedName() + " - Success");
        }

        if (ItemUtils.checkForInvalidItems(material.getRod(1)) && ItemUtils.checkForInvalidItems(material.getBolt(1))) {
            GT_Values.RA.stdBuilder()
                .itemInputs(material.getRod(1))
                .itemOutputs(material.getBolt(4))
                .duration(Math.max(material.getMass() * 2L, 1L))
                .eut(material.vVoltageMultiplier)
                .addTo(cutterRecipes);

            Logger.WARNING("Cut Bolt Recipe: " + material.getLocalizedName() + " - Success");
        }

        if (ItemUtils.checkForInvalidItems(material.getIngot(1))
            && ItemUtils.checkForInvalidItems(material.getHotIngot(1))) {

            GT_Values.RA.stdBuilder()
                .itemInputs(material.getHotIngot(1))
                .itemOutputs(material.getIngot(1))
                .duration((int) Math.max(material.getMass() * 3L, 1L))
                .eut(material.vVoltageMultiplier)
                .addTo(vacuumFreezerRecipes);
            Logger.WARNING("Cool Hot Ingot Recipe: " + material.getLocalizedName() + " - Success");
        }

        if (ItemUtils.checkForInvalidItems(material.getRod(1))
            && ItemUtils.checkForInvalidItems(material.getLongRod(1))) {
            GT_Values.RA.stdBuilder()
                .itemInputs(material.getRod(2))
                .itemOutputs(material.getLongRod(1))
                .duration((int) Math.max(material.getMass(), 1L))
                .eut(16)
                .addTo(hammerRecipes);

            Logger.WARNING("Hammer Long Rod Recipe: " + material.getLocalizedName() + " - Success");

            GT_Values.RA.stdBuilder()
                .itemInputs(material.getLongRod(1))
                .itemOutputs(material.getRod(2))
                .duration(Math.max(material.getMass(), 1L))
                .eut(4)
                .addTo(cutterRecipes);

        }

        if (ItemUtils.checkForInvalidItems(material.getBolt(1))
            && ItemUtils.checkForInvalidItems(material.getScrew(1))) {
            GT_Values.RA.stdBuilder()
                .itemInputs(material.getBolt(1))
                .itemOutputs(material.getScrew(1))
                .duration(Math.max(material.getMass() / 8L, 1L))
                .eut(4)
                .addTo(latheRecipes);

            Logger.WARNING("Lathe Screw Recipe: " + material.getLocalizedName() + " - Success");
        }
    }
}