aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MetalRecipe.java
blob: b08daa7d9a3c45b1c05ac16590509e95d81ff140 (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
122
123
124
125
package gtPlusPlus.xmod.gregtech.loaders;

import gregtech.api.enums.GT_Values;
import gregtech.api.util.GT_ModHandler;
import gtPlusPlus.api.interfaces.RunnableWithInfo;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialGenerator;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import java.util.HashSet;
import java.util.Set;

public class RecipeGen_MetalRecipe extends RecipeGen_Base {

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

    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)))
            if (GT_ModHandler.addCompressionRecipe(material.getIngot(9), material.getBlock(1))) {
                Logger.WARNING("Compress Block Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Compress Block Recipe: " + material.getLocalizedName() + " - Failed");
            }

        if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getRod(1)))
            if (GT_Values.RA.addLatheRecipe(
                    material.getIngot(1),
                    material.getRod(1),
                    material.getSmallDust(2),
                    (int) Math.max(material.getMass() / 8L, 1L),
                    material.vVoltageMultiplier)) {
                Logger.WARNING("Lathe Rod Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Lathe Rod Recipe: " + material.getLocalizedName() + " - Failed");
            }

        if (ItemUtils.checkForInvalidItems(material.getRod(1)) && ItemUtils.checkForInvalidItems(material.getBolt(1)))
            if (GT_Values.RA.addCutterRecipe(
                    material.getRod(1),
                    material.getBolt(4),
                    null,
                    (int) Math.max(material.getMass() * 2L, 1L),
                    material.vVoltageMultiplier)) {
                Logger.WARNING("Cut Bolt Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Cut Bolt Recipe: " + material.getLocalizedName() + " - Failed");
            }

        if (ItemUtils.checkForInvalidItems(material.getIngot(1))
                && ItemUtils.checkForInvalidItems(material.getHotIngot(1)))
            if (CORE.RA.addVacuumFreezerRecipe(
                    material.getHotIngot(1),
                    material.getIngot(1),
                    (int) Math.max(material.getMass() * 3L, 1L),
                    material.vVoltageMultiplier)) {
                Logger.WARNING("Cool Hot Ingot Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Cool Hot Ingot Recipe: " + material.getLocalizedName() + " - Failed");
            }

        if (ItemUtils.checkForInvalidItems(material.getRod(1))
                && ItemUtils.checkForInvalidItems(material.getLongRod(1))) {
            if (GT_Values.RA.addForgeHammerRecipe(
                    material.getRod(2), material.getLongRod(1), (int) Math.max(material.getMass(), 1L), 16)) {
                Logger.WARNING("Hammer Long Rod Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Hammer Long Rod Recipe: " + material.getLocalizedName() + " - Failed");
            }

            GT_Values.RA.addCutterRecipe(
                    material.getLongRod(1), material.getRod(2), null, (int) Math.max(material.getMass(), 1L), 4);
        }

        if (ItemUtils.checkForInvalidItems(material.getBolt(1)) && ItemUtils.checkForInvalidItems(material.getScrew(1)))
            if (GT_Values.RA.addLatheRecipe(
                    material.getBolt(1), material.getScrew(1), null, (int) Math.max(material.getMass() / 8L, 1L), 4)) {
                Logger.WARNING("Lathe Screw Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Lathe Screw Recipe: " + material.getLocalizedName() + " - Failed");
            }

        // Fine Wire
        if (ItemUtils.checkForInvalidItems(material.getFineWire(1))
                && (ItemUtils.checkForInvalidItems(material.getIngot(1))
                        || ItemUtils.checkForInvalidItems(material.getWire01(1))))
            if (GT_Values.RA.addWiremillRecipe(
                    ItemUtils.checkForInvalidItems(material.getWire01(1))
                            ? material.getWire01(1)
                            : material.getIngot(1),
                    material.getFineWire(ItemUtils.checkForInvalidItems(material.getWire01(1)) ? 4 : 8),
                    100,
                    4)) {
                Logger.WARNING("Wiremill Fine Wire Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Wiremill Fine Wire Recipe: " + material.getLocalizedName() + " - Failed");
            }

        // Fine Wire
        if (ItemUtils.checkForInvalidItems(material.getFineWire(1))
                && (ItemUtils.checkForInvalidItems(material.getRod(1))))
            if (GT_Values.RA.addWiremillRecipe(material.getRod(1), material.getFineWire(4), 50, 4)) {
                Logger.WARNING("Wiremill Fine Wire Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Wiremill Fine Wire Recipe: " + material.getLocalizedName() + " - Failed");
            }
    }
}