aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGenShapedCrafting.java
blob: 3fd856e801bbed49c030926ddc499b47f8e612a1 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
package gtPlusPlus.xmod.gregtech.loaders;

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

import gregtech.api.util.GTModHandler;
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 RecipeGenShapedCrafting extends RecipeGenBase {

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

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

    public RecipeGenShapedCrafting(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 Shaped Crafting recipes for " + material.getLocalizedName()); // TODO

        // Single Plate Shaped/Shapeless
        if (ItemUtils.checkForInvalidItems(material.getPlate(1))
            && ItemUtils.checkForInvalidItems(material.getIngot(1)))
            if (material.getPlate(1) != null && material.getIngot(1) != null) GTModHandler.addCraftingRecipe(
                material.getPlate(1),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "h", "B", "I", 'I', material.getIngot(1), 'B', material.getIngot(1) });

        if (ItemUtils.checkForInvalidItems(material.getPlate(1))
            && ItemUtils.checkForInvalidItems(material.getIngot(1)))
            GTModHandler.addShapelessCraftingRecipe(
                material.getPlate(1),
                new Object[] { gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, material.getIngot(1),
                    material.getIngot(1) });

        // Double Plate Shaped/Shapeless
        if (ItemUtils.checkForInvalidItems(material.getPlateDouble(1))
            && ItemUtils.checkForInvalidItems(material.getPlate(1)))
            GTModHandler.addCraftingRecipe(
                material.getPlateDouble(1),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "I", "B", "h", 'I', material.getPlate(1), 'B', material.getPlate(1) });

        if (ItemUtils.checkForInvalidItems(material.getPlateDouble(1))
            && ItemUtils.checkForInvalidItems(material.getPlate(1)))
            GTModHandler.addShapelessCraftingRecipe(
                material.getPlateDouble(1),
                new Object[] { gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, material.getPlate(1),
                    material.getPlate(1) });

        // Ring Recipe
        if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getRing(1))
            && ItemUtils.checkForInvalidItems(material.getRod(1))) {
            if (GTModHandler.addCraftingRecipe(
                material.getRing(1),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "h ", "fR", 'R', material.getRod(1) })) {
                Logger.WARNING("GT:NH Ring Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("GT:NH Ring Recipe: " + material.getLocalizedName() + " - Failed");
            }
        }

        // Framebox Recipe
        if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getFrameBox(1))
            && ItemUtils.checkForInvalidItems(material.getRod(1))) {
            if (GTModHandler.addCraftingRecipe(
                material.getFrameBox(2),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "RRR", "RwR", "RRR", 'R', material.getRod(1) })) {
                Logger.WARNING("Framebox Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Framebox Recipe: " + material.getLocalizedName() + " - Failed");
            }
        }

        // Shaped Recipe - Bolts
        if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getBolt(1))
            && ItemUtils.checkForInvalidItems(material.getRod(1))) {
            if (GTModHandler.addCraftingRecipe(
                material.getBolt(2),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "s ", " R", 'R', material.getRod(1) })) {
                Logger.WARNING("Bolt Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Bolt Recipe: " + material.getLocalizedName() + " - Failed");
            }
        }

        // Shaped Recipe - Fine Wire
        if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getFoil(1))
            && ItemUtils.checkForInvalidItems(material.getFineWire(1))) {
            if (GTModHandler.addCraftingRecipe(
                material.getFineWire(1),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "Fx", 'F', material.getFoil(1) })) {
                Logger.WARNING("Fine Wire Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Fine Wire Recipe: " + material.getLocalizedName() + " - Failed");
            }
        }

        // Shaped Recipe - Foil
        if (ItemUtils.checkForInvalidItems(material.getFoil(1))
            && ItemUtils.checkForInvalidItems(material.getPlate(1))) {
            if (GTModHandler.addCraftingRecipe(
                material.getFoil(2),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "hP", 'P', material.getPlate(1) })) {
                Logger.WARNING("Foil Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Foil Recipe: " + material.getLocalizedName() + " - Failed");
            }
        }

        // Shaped Recipe - Ingot to Rod
        if (ItemUtils.checkForInvalidItems(material.getRod(1)) && ItemUtils.checkForInvalidItems(material.getIngot(1)))
            if (GTModHandler.addCraftingRecipe(
                material.getRod(1),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "f ", " I", 'I', material.getIngot(1) })) {
                    Logger.WARNING("Rod Recipe: " + material.getLocalizedName() + " - Success");
                } else {
                    Logger.WARNING("Rod Recipe: " + material.getLocalizedName() + " - Failed");
                }

        // Shaped Recipe - Long Rod to two smalls
        if (ItemUtils.checkForInvalidItems(material.getRod(1))
            && ItemUtils.checkForInvalidItems(material.getLongRod(1)))
            if (GTModHandler.addCraftingRecipe(
                material.getRod(2),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "s", "L", 'L', material.getLongRod(1) })) {
                    Logger.WARNING("Rod Recipe: " + material.getLocalizedName() + " - Success");
                } else {
                    Logger.WARNING("Rod Recipe: " + material.getLocalizedName() + " - Failed");
                }

        // Two small to long rod
        if (ItemUtils.checkForInvalidItems(material.getLongRod(1))
            && ItemUtils.checkForInvalidItems(material.getRod(1)))
            if (GTModHandler.addCraftingRecipe(
                material.getLongRod(1),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "RhR", 'R', material.getRod(1) })) {
                    Logger.WARNING("Long Rod Recipe: " + material.getLocalizedName() + " - Success");
                } else {
                    Logger.WARNING("Long Rod Recipe: " + material.getLocalizedName() + " - Failed");
                }

        // Rotor Recipe
        if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getRotor(1))
            && ItemUtils.checkForInvalidItems(material.getRing(1))
            && !material.isRadioactive
            && ItemUtils.checkForInvalidItems(material.getPlate(1))
            && ItemUtils.checkForInvalidItems(material.getScrew(1))) {
            if (GTModHandler.addCraftingRecipe(
                material.getRotor(1),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "PhP", "SRf", "PdP", 'P', material.getPlate(1), 'S', material.getScrew(1), 'R',
                    material.getRing(1), })) {
                Logger.WARNING("Rotor Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Rotor Recipe: " + material.getLocalizedName() + " - Failed");
            }
        }

        // Gear Recipe
        if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getGear(1))
            && ItemUtils.checkForInvalidItems(material.getPlate(1))
            && ItemUtils.checkForInvalidItems(material.getRod(1))) {
            if (GTModHandler.addCraftingRecipe(
                material.getGear(1),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "RPR", "PwP", "RPR", 'P', material.getPlate(1), 'R', material.getRod(1), })) {
                Logger.WARNING("Gear Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Gear Recipe: " + material.getLocalizedName() + " - Failed");
            }
        }

        // Screws
        if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getScrew(1))
            && ItemUtils.checkForInvalidItems(material.getBolt(1))) {
            if (GTModHandler.addCraftingRecipe(
                material.getScrew(1),
                GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED,
                new Object[] { "fB", "B ", 'B', material.getBolt(1), })) {
                Logger.WARNING("Screw Recipe: " + material.getLocalizedName() + " - Success");
            } else {
                Logger.WARNING("Screw Recipe: " + material.getLocalizedName() + " - Failed");
            }
        }
    }
}