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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
|
package gregtech.loaders.oreprocessing;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ConfigCategories;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.SubTag;
import gregtech.api.enums.TextureSet;
import gregtech.api.enums.ToolDictNames;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_StdRenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_RecipeRegistrator;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Proxy;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import static gregtech.api.enums.GT_Values.RA;
import static gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED;
import static gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS;
public class ProcessingPlate implements gregtech.api.interfaces.IOreRecipeRegistrator {
public ProcessingPlate() {
OrePrefixes.plate.add(this);
OrePrefixes.plateDouble.add(this);
OrePrefixes.plateTriple.add(this);
OrePrefixes.plateQuadruple.add(this);
OrePrefixes.plateQuintuple.add(this);
OrePrefixes.plateDense.add(this);
OrePrefixes.plateAlloy.add(this);
OrePrefixes.itemCasing.add(this);
}
/**
* Register processes for the item stack by its Ore Dictionary Name property for all plate related items
*
* @param aPrefix always != null, the Ore Prefix
* @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based!
* @param aOreDictName the Ore Dictionary Name
* @param aModName the name of the mod providing this stack
* @param aStack always != null, the {@link ItemStack} to register
*/
public void registerOre(OrePrefixes aPrefix,
Materials aMaterial,
String aOreDictName,
String aModName,
ItemStack aStack) {
final boolean aNoSmashing = aMaterial.contains(SubTag.NO_SMASHING);
final boolean aNoWorking = aMaterial.contains(SubTag.NO_WORKING);
final long aMaterialMass = aMaterial.getMass();
switch (aPrefix) {
case plate:
registerPlate(aMaterial, aStack, aNoSmashing);
break;
case plateDouble:
registerPlateDouble(aMaterial, aStack, aNoSmashing, aMaterialMass);
break;
case plateTriple:
registerPlateTriple(aMaterial, aStack, aNoSmashing, aMaterialMass);
break;
case plateQuadruple:
registerPlateQuadruple(aMaterial, aStack, aNoSmashing, aMaterialMass, aNoWorking);
break;
case plateQuintuple:
registerPlateQuintuple(aMaterial, aStack, aNoSmashing, aMaterialMass);
break;
case plateDense:
registerPlateDense(aMaterial, aStack, aNoSmashing, aMaterialMass);
break;
case itemCasing:
registerItemCasing(aPrefix, aMaterial, aStack, aNoSmashing);
break;
case plateAlloy:
registerPlateAlloy(aOreDictName, aStack);
break;
default:
break;
}
}
private void registerPlate(final Materials aMaterial, final ItemStack aStack, final boolean aNoSmashing) {
GT_ModHandler.removeRecipeByOutputDelayed(aStack);
GT_ModHandler.removeRecipeDelayed(aStack);
if (aMaterial.mStandardMoltenFluid != null &&
!(aMaterial == Materials.AnnealedCopper || aMaterial == Materials.WroughtIron)) {
RA.addFluidSolidifierRecipe(
ItemList.Shape_Mold_Plate.get(0L),
aMaterial.getMolten(144L),
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L),
32, 8);
}
registerCover(aMaterial, aStack);
if (aMaterial.mFuelPower > 0)
RA.addFuel(GT_Utility.copyAmount(1L, aStack), null, aMaterial.mFuelPower, aMaterial.mFuelType);
GT_Utility.removeSimpleIC2MachineRecipe(
GT_Utility.copyAmount(9L, aStack),
GT_ModHandler.getCompressorRecipeList(),
GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L));
GT_ModHandler.addCraftingRecipe(
GT_OreDictUnificator.get(OrePrefixes.foil, aMaterial, 2L),
GT_Proxy.tBits,
new Object[]{"hX", 'X', OrePrefixes.plate.get(aMaterial)});
if (aMaterial == Materials.Paper)
GT_ModHandler.addCraftingRecipe(
GT_Utility.copyAmount(
GregTech_API.sRecipeFile.get(
gregtech.api.enums.ConfigCategories.Recipes.harderrecipes, aStack, true
) ? 2L : 3L,
aStack),
BUFFERED,
new Object[]{"XXX", 'X', new ItemStack(net.minecraft.init.Items.reeds, 1, 32767)});
if ((aMaterial.mUnificatable) && (aMaterial.mMaterialInto == aMaterial)) {
if (!aNoSmashing &&
GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammerplating, aMaterial.toString(), true)) {
GT_ModHandler.addCraftingRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L),
GT_Proxy.tBits, new Object[]{"h", "X", "X", 'X', OrePrefixes.ingot.get(aMaterial)});
GT_ModHandler.addCraftingRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L),
GT_Proxy.tBits,
new Object[]{
"H", "X", 'H', ToolDictNames.craftingToolForgeHammer,
'X', OrePrefixes.ingot.get(aMaterial)});
GT_ModHandler.addCraftingRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L),
GT_Proxy.tBits,
new Object[]{"h", "X", 'X', OrePrefixes.gem.get(aMaterial)});
GT_ModHandler.addCraftingRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L),
GT_Proxy.tBits,
new Object[]{
"H", "X", 'H', ToolDictNames.craftingToolForgeHammer,
'X', OrePrefixes.gem.get(aMaterial)});
}
if ((aMaterial.contains(SubTag.MORTAR_GRINDABLE)) &&
(GregTech_API.sRecipeFile.get(ConfigCategories.Tools.mortar, aMaterial.mName, true))) {
GT_ModHandler.addCraftingRecipe(
GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 1L),
GT_Proxy.tBits,
new Object[]{"X", "m", 'X', OrePrefixes.plate.get(aMaterial)});
}
}
}
private void registerPlateDouble(final Materials aMaterial,
final ItemStack aStack,
final boolean aNoSmashing,
final long aMaterialMass) {
GT_ModHandler.removeRecipeByOutputDelayed(aStack);
registerCover(aMaterial, aStack);
if (!aNoSmashing) {
RA.addBenderRecipe(
GT_Utility.copyAmount(2L, aStack),
GT_OreDictUnificator.get(OrePrefixes.plateQuadruple, aMaterial, 1L),
(int) Math.max(aMaterialMass * 2L, 1L), 96);
if (GregTech_API.sRecipeFile.get(
gregtech.api.enums.ConfigCategories.Tools.hammerdoubleplate,
OrePrefixes.plate.get(aMaterial).toString(), true)) {
Object aPlateStack = OrePrefixes.plate.get(aMaterial);
GT_ModHandler.addCraftingRecipe(
GT_Utility.copyAmount(1L, aStack),
DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED,
new Object[]{"I", "B", "h", 'I', aPlateStack, 'B', aPlateStack});
GT_ModHandler.addShapelessCraftingRecipe(
GT_Utility.copyAmount(1L, aStack),
new Object[]{
gregtech.api.enums.ToolDictNames.craftingToolForgeHammer,
aPlateStack,
aPlateStack});
}
RA.addBenderRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 2L),
GT_Utility.copyAmount(1L, aStack),
(int) Math.max(aMaterialMass * 2L, 1L),
96);
} else {
RA.addAssemblerRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 2L),
gregtech.api.enums.ItemList.Circuit_Integrated.getWithDamage(0L, 2L),
Materials.Glue.getFluid(10L),
GT_Utility.copyAmount(1L, aStack),
64, 8);
}
}
private void registerPlateTriple(final Materials aMaterial,
final ItemStack aStack,
final boolean aNoSmashing,
final long aMaterialMass) {
GT_ModHandler.removeRecipeByOutputDelayed(aStack);
registerCover(aMaterial, aStack);
if (!aNoSmashing) {
RA.addBenderRecipe(
GT_Utility.copyAmount(3L, aStack),
GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L),
(int) Math.max(aMaterialMass * 3L, 1L),
96);
if (GregTech_API.sRecipeFile.get(
gregtech.api.enums.ConfigCategories.Tools.hammertripleplate,
OrePrefixes.plate.get(aMaterial).toString(), true)) {
Object aPlateStack = OrePrefixes.plate.get(aMaterial);
GT_ModHandler.addCraftingRecipe(
GT_Utility.copyAmount(1L, aStack),
DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED,
new Object[]{"I", "B", "h", 'I', OrePrefixes.plateDouble.get(aMaterial), 'B', aPlateStack});
GT_ModHandler.addShapelessCraftingRecipe(
GT_Utility.copyAmount(1L, aStack),
new Object[]{
gregtech.api.enums.ToolDictNames.craftingToolForgeHammer,
aPlateStack, aPlateStack, aPlateStack});
}
RA.addBenderRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 3L),
GT_Utility.copyAmount(1L, aStack),
(int) Math.max(aMaterialMass * 3L, 1L),
96);
} else {
RA.addAssemblerRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 3L),
gregtech.api.enums.ItemList.Circuit_Integrated.getWithDamage(0L, 3L),
Materials.Glue.getFluid(20L),
GT_Utility.copyAmount(1L, aStack),
96, 8);
}
RA.addImplosionRecipe(
GT_Utility.copyAmount(1L, aStack),
2,
GT_OreDictUnificator.get(OrePrefixes.compressed, aMaterial, 1L),
GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L));
}
private void registerPlateQuadruple(final Materials aMaterial,
final ItemStack aStack,
final boolean aNoSmashing,
final long aMaterialMass,
final boolean aNoWorking) {
GT_ModHandler.removeRecipeByOutputDelayed(aStack);
registerCover(aMaterial, aStack);
if (!aNoWorking)
RA.addCNCRecipe(
GT_Utility.copyAmount(1L, aStack),
GT_OreDictUnificator.get(OrePrefixes.gearGt, aMaterial, 1L),
(int) Math.max(aMaterialMass * 2L, 1L),
30);
if (!aNoSmashing) {
if (GregTech_API.sRecipeFile.get(
gregtech.api.enums.ConfigCategories.Tools.hammerquadrupleplate,
OrePrefixes.plate.get(aMaterial).toString(), true)) {
Object aPlateStack = OrePrefixes.plate.get(aMaterial);
GT_ModHandler.addCraftingRecipe(
GT_Utility.copyAmount(1L, aStack),
DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED,
new Object[]{"I", "B", "h", 'I', OrePrefixes.plateTriple.get(aMaterial), 'B', aPlateStack});
GT_ModHandler.addShapelessCraftingRecipe(
GT_Utility.copyAmount(1L, aStack),
new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer,
aPlateStack, aPlateStack, aPlateStack, aPlateStack});
}
RA.addBenderRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L),
GT_Utility.copyAmount(1L, aStack),
(int) Math.max(aMaterialMass * 4L, 1L),
96);
} else {
RA.addAssemblerRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L),
gregtech.api.enums.ItemList.Circuit_Integrated.getWithDamage(0L, 4L),
Materials.Glue.getFluid(30L), GT_Utility.copyAmount(1L, aStack),
128, 8);
}
}
private void registerPlateQuintuple(final Materials aMaterial,
final ItemStack aStack,
final boolean aNoSmashing,
final long aMaterialMass) {
GT_ModHandler.removeRecipeByOutputDelayed(aStack);
registerCover(aMaterial, aStack);
if (!aNoSmashing) {
if (GregTech_API.sRecipeFile.get(
gregtech.api.enums.ConfigCategories.Tools.hammerquintupleplate,
OrePrefixes.plate.get(aMaterial).toString(), true)) {
Object aPlateStack = OrePrefixes.plate.get(aMaterial);
GT_ModHandler.addCraftingRecipe(
GT_Utility.copyAmount(1L, aStack),
DO_NOT_CHECK_FOR_COLLISIONS | BUFFERED,
new Object[]{"I", "B", "h", 'I', OrePrefixes.plateQuadruple.get(aMaterial), 'B', aPlateStack});
GT_ModHandler.addShapelessCraftingRecipe(
GT_Utility.copyAmount(1L, aStack),
new Object[]{ToolDictNames.craftingToolForgeHammer,
aPlateStack, aPlateStack, aPlateStack, aPlateStack, aPlateStack});
}
RA.addBenderRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 5L),
GT_Utility.copyAmount(1L, aStack),
(int) Math.max(aMaterialMass * 5L, 1L),
96);
} else {
RA.addAssemblerRecipe(
gregtech.api.util.GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 5L),
ItemList.Circuit_Integrated.getWithDamage(0L, 5L),
Materials.Glue.getFluid(40L),
GT_Utility.copyAmount(1L, aStack),
160, 8);
}
}
private void registerPlateDense(final Materials aMaterial,
final ItemStack aStack,
final boolean aNoSmashing,
final long aMaterialMass) {
GT_ModHandler.removeRecipeByOutputDelayed(aStack);
registerCover(aMaterial, aStack);
if (!aNoSmashing) {
RA.addBenderRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 9L),
GT_Utility.copyAmount(1L, aStack), (int) Math.max(aMaterialMass * 9L, 1L),
96);
}
}
private void registerItemCasing(final OrePrefixes aPrefix,
final Materials aMaterial,
final ItemStack aStack,
final boolean aNoSmashing) {
GT_ModHandler.removeRecipeByOutputDelayed(aStack);
if (aMaterial.mStandardMoltenFluid != null) {
RA.addFluidSolidifierRecipe(
ItemList.Shape_Mold_Casing.get(0L),
aMaterial.getMolten(72L),
GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 1L),
16, 8);
}
if (aMaterial.mUnificatable &&
aMaterial.mMaterialInto == aMaterial &&
!aNoSmashing &&
GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammerplating, aMaterial.toString(), true)) {
GT_ModHandler.addCraftingRecipe(
GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 1L),
GT_Proxy.tBits, new Object[]{"h X", 'X', OrePrefixes.plate.get(aMaterial)});
GT_ModHandler.addCraftingRecipe(
GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 1L),
GT_Proxy.tBits,
new Object[]{
"H X", 'H', ToolDictNames.craftingToolForgeHammer, 'X', OrePrefixes.plate.get(aMaterial)});
}
RA.addAlloySmelterRecipe(
GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 2L),
ItemList.Shape_Mold_Casing.get(0L), GT_Utility.copyAmount(3L, aStack), 128, 15);
RA.addCutterRecipe(
GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L),
GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 2L),
null,
(int) Math.max(aMaterial.getMass(), 1L),
16);
RA.addExtruderRecipe(
GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L),
ItemList.Shape_Extruder_Casing.get(0L),
GT_OreDictUnificator.get(OrePrefixes.itemCasing, aMaterial, 2L),
(int) Math.max(aMaterial.getMass(), 1L),
45);
GT_RecipeRegistrator.registerReverseFluidSmelting(aStack, aMaterial, aPrefix.mMaterialAmount, null);
}
private void registerPlateAlloy(final String aOreDictName, final ItemStack aStack) {
switch (aOreDictName) {
case "plateAlloyCarbon":
RA.addAssemblerRecipe(
GT_ModHandler.getIC2Item("generator", 1L),
GT_Utility.copyAmount(4L, aStack),
GT_ModHandler.getIC2Item("windMill", 1L),
6400, 8);
break;
case "plateAlloyAdvanced":
GT_ModHandler.addAlloySmelterRecipe(
GT_Utility.copyAmount(1L, aStack),
new ItemStack(Blocks.glass, 3, 32767),
GT_ModHandler.getIC2Item("reinforcedGlass", 4L),
400, 4, false);
GT_ModHandler.addAlloySmelterRecipe(
GT_Utility.copyAmount(1L, aStack),
GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glass, 3L),
GT_ModHandler.getIC2Item("reinforcedGlass", 4L),
400, 4, false);
break;
case "plateAlloyIridium":
// Remove IC2 Shaped recipe for Iridium Reinforced Plate
GT_ModHandler.removeRecipeByOutputDelayed(aStack);
break;
default:
break;
}
}
private void registerCover(final Materials aMaterial, final ItemStack aStack) {
// Get ItemStack of Block matching Materials
final ItemStack tStack = aMaterial.getBlocks(1);
// Register the cover
GregTech_API.registerCover(
aStack,
// If there is an ItemStack of Block for Materials
tStack != null ?
// Copy Block texture
new GT_CopiedBlockTexture(Block.getBlockFromItem(tStack.getItem()), 1, tStack.getItemDamage()) :
// or use Materials mRGBa dyed blocs/materialicons/MATERIALSET/block1 icons
new GT_StdRenderedTexture(
aMaterial.mIconSet.mTextures[TextureSet.INDEX_block1], aMaterial.mRGBa, false),
null);
}
}
|