aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/recipe/common/CI.java
blob: 525c43883cf12ce624b7ce6d11a0bc9b1a2f5070 (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
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
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
package gtPlusPlus.core.recipe.common;

import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;

import gregtech.api.GregTechAPI;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.ExternalMaterials;
import gregtech.api.util.GTModHandler;
import gregtech.api.util.GTOreDictUnificator;
import gregtech.api.util.GTUtility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.item.chemistry.AgriculturalChem;
import gtPlusPlus.core.item.chemistry.GenericChem;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialsAlloy;
import gtPlusPlus.core.material.MaterialsElements;
import gtPlusPlus.core.recipe.LoaderMachineComponents;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import ic2.core.Ic2Items;

public class CI {

    // null
    public static ItemStack _NULL = ItemUtils.getErrorStack(1);

    // bits
    public static long bits = GTModHandler.RecipeBits.NOT_REMOVABLE | GTModHandler.RecipeBits.REVERSIBLE
        | GTModHandler.RecipeBits.BUFFERED;
    public static long bitsd = GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.NOT_REMOVABLE
        | GTModHandler.RecipeBits.REVERSIBLE
        | GTModHandler.RecipeBits.BUFFERED;

    // Circuits
    public static Object circuitPrimitive;
    public static Object circuitTier1;
    public static Object circuitTier2;
    public static Object circuitTier3;
    public static Object circuitTier4;
    public static Object circuitTier5;
    public static Object circuitTier6;
    public static Object circuitTier7;
    public static Object circuitTier8;
    public static Object circuitTier9;

    // Machine Components
    public static ItemStack electricMotor_LV;
    public static ItemStack electricMotor_MV;
    public static ItemStack electricMotor_HV;
    public static ItemStack electricMotor_EV;
    public static ItemStack electricMotor_IV;
    public static ItemStack electricMotor_LuV;
    public static ItemStack electricMotor_ZPM;
    public static ItemStack electricMotor_UV;
    public static ItemStack electricMotor_UHV;
    public static ItemStack electricPump_LV;
    public static ItemStack electricPump_MV;
    public static ItemStack electricPump_HV;
    public static ItemStack electricPump_EV;
    public static ItemStack electricPump_IV;
    public static ItemStack electricPump_LuV;
    public static ItemStack electricPump_ZPM;
    public static ItemStack electricPump_UV;
    public static ItemStack electricPump_UHV;
    public static ItemStack electricPiston_LV;
    public static ItemStack electricPiston_MV;
    public static ItemStack electricPiston_HV;
    public static ItemStack electricPiston_EV;
    public static ItemStack electricPiston_IV;
    public static ItemStack electricPiston_LuV;
    public static ItemStack electricPiston_ZPM;
    public static ItemStack electricPiston_UV;
    public static ItemStack electricPiston_UHV;
    public static ItemStack robotArm_LV;
    public static ItemStack robotArm_MV;
    public static ItemStack robotArm_HV;
    public static ItemStack robotArm_EV;
    public static ItemStack robotArm_IV;
    public static ItemStack robotArm_LuV;
    public static ItemStack robotArm_ZPM;
    public static ItemStack robotArm_UV;
    public static ItemStack robotArm_UHV;
    public static ItemStack conveyorModule_LV;
    public static ItemStack conveyorModule_MV;
    public static ItemStack conveyorModule_HV;
    public static ItemStack conveyorModule_EV;
    public static ItemStack conveyorModule_IV;
    public static ItemStack conveyorModule_LuV;
    public static ItemStack conveyorModule_ZPM;
    public static ItemStack conveyorModule_UV;
    public static ItemStack conveyorModule_UHV;
    public static ItemStack emitter_LV;
    public static ItemStack emitter_MV;
    public static ItemStack emitter_HV;
    public static ItemStack emitter_EV;
    public static ItemStack emitter_IV;
    public static ItemStack emitter_LuV;
    public static ItemStack emitter_ZPM;
    public static ItemStack emitter_UV;
    public static ItemStack emitter_UHV;
    public static ItemStack fieldGenerator_LV;
    public static ItemStack fieldGenerator_MV;
    public static ItemStack fieldGenerator_HV;
    public static ItemStack fieldGenerator_EV;
    public static ItemStack fieldGenerator_IV;
    public static ItemStack fieldGenerator_LuV;
    public static ItemStack fieldGenerator_ZPM;
    public static ItemStack fieldGenerator_UV;
    public static ItemStack fieldGenerator_UHV;
    public static ItemStack sensor_LV;
    public static ItemStack sensor_MV;
    public static ItemStack sensor_HV;
    public static ItemStack sensor_EV;
    public static ItemStack sensor_IV;
    public static ItemStack sensor_LuV;
    public static ItemStack sensor_ZPM;
    public static ItemStack sensor_UV;
    public static ItemStack sensor_UHV;

    public static ItemStack fluidRegulator_LV;
    public static ItemStack fluidRegulator_MV;
    public static ItemStack fluidRegulator_HV;
    public static ItemStack fluidRegulator_EV;
    public static ItemStack fluidRegulator_IV;
    public static ItemStack fluidRegulator_LuV;
    public static ItemStack fluidRegulator_ZPM;
    public static ItemStack fluidRegulator_UV;

    // Machine Casings
    public static ItemStack machineCasing_ULV;
    public static ItemStack machineCasing_LV;
    public static ItemStack machineCasing_MV;
    public static ItemStack machineCasing_HV;
    public static ItemStack machineCasing_EV;
    public static ItemStack machineCasing_IV;
    public static ItemStack machineCasing_LuV;
    public static ItemStack machineCasing_ZPM;
    public static ItemStack machineCasing_UV;
    public static ItemStack machineCasing_UHV;

    // Machine Hulls
    public static ItemStack machineHull_ULV;
    public static ItemStack machineHull_LV;
    public static ItemStack machineHull_MV;
    public static ItemStack machineHull_HV;
    public static ItemStack machineHull_EV;
    public static ItemStack machineHull_IV;
    public static ItemStack machineHull_LuV;
    public static ItemStack machineHull_ZPM;
    public static ItemStack machineHull_UV;
    public static ItemStack machineHull_UHV;

    // Gearbox Casings
    public static ItemStack gearboxCasing_Tier_1;
    public static ItemStack gearboxCasing_Tier_2;
    public static ItemStack gearboxCasing_Tier_3;
    public static ItemStack gearboxCasing_Tier_4;

    public static String[] component_Plate;
    public static String[] component_Rod;
    public static String[] component_Ingot;

    // Crafting Tools
    public static String craftingToolWrench = "craftingToolWrench";
    public static String craftingToolHammer_Hard = "craftingToolHardHammer";
    public static String craftingToolScrewdriver = "craftingToolScrewdriver";
    public static String craftingToolFile = "craftingToolFile";
    public static String craftingToolMortar = "craftingToolMortar";
    public static String craftingToolSaw = "craftingToolSaw";
    public static String craftingToolWireCutter = "craftingToolWirecutter";
    public static String craftingToolSolderingIron = "craftingToolSolderingIron";

    // Explosives
    public static ItemStack explosivePowderKeg;
    public static ItemStack explosiveTNT;
    public static ItemStack explosiveITNT;

    public static Materials[] tieredMaterials = new Materials[] { Materials.Iron, Materials.Steel, Materials.Aluminium,
        Materials.StainlessSteel, Materials.Titanium, Materials.TungstenSteel,
        ExternalMaterials.getRhodiumPlatedPalladium(), Materials.Iridium, Materials.Osmium, Materials.Neutronium };

    public static void preInit() {

        // Tiered Components
        component_Plate = new String[] { getTieredComponent(OrePrefixes.plate, 0),
            getTieredComponent(OrePrefixes.plate, 1), getTieredComponent(OrePrefixes.plate, 2),
            getTieredComponent(OrePrefixes.plate, 3), getTieredComponent(OrePrefixes.plate, 4),
            getTieredComponent(OrePrefixes.plate, 5), getTieredComponent(OrePrefixes.plate, 6),
            getTieredComponent(OrePrefixes.plate, 7), getTieredComponent(OrePrefixes.plate, 8),
            getTieredComponent(OrePrefixes.plate, 9), getTieredComponent(OrePrefixes.plate, 10),
            getTieredComponent(OrePrefixes.plate, 11) };
        component_Rod = new String[] { getTieredComponent(OrePrefixes.stick, 0),
            getTieredComponent(OrePrefixes.stick, 1), getTieredComponent(OrePrefixes.stick, 2),
            getTieredComponent(OrePrefixes.stick, 3), getTieredComponent(OrePrefixes.stick, 4),
            getTieredComponent(OrePrefixes.stick, 5), getTieredComponent(OrePrefixes.stick, 6),
            getTieredComponent(OrePrefixes.stick, 7), getTieredComponent(OrePrefixes.stick, 8),
            getTieredComponent(OrePrefixes.stick, 9), getTieredComponent(OrePrefixes.stick, 10),
            getTieredComponent(OrePrefixes.stick, 11) };
        component_Ingot = new String[] { getTieredComponent(OrePrefixes.ingot, 0),
            getTieredComponent(OrePrefixes.ingot, 1), getTieredComponent(OrePrefixes.ingot, 2),
            getTieredComponent(OrePrefixes.ingot, 3), getTieredComponent(OrePrefixes.ingot, 4),
            getTieredComponent(OrePrefixes.ingot, 5), getTieredComponent(OrePrefixes.ingot, 6),
            getTieredComponent(OrePrefixes.ingot, 7), getTieredComponent(OrePrefixes.ingot, 8),
            getTieredComponent(OrePrefixes.ingot, 9), getTieredComponent(OrePrefixes.ingot, 10),
            getTieredComponent(OrePrefixes.ingot, 11) };

        // Circuits
        circuitPrimitive = getTieredCircuit(0);
        circuitTier1 = getTieredCircuit(1);
        circuitTier2 = getTieredCircuit(2);
        circuitTier3 = getTieredCircuit(3);
        circuitTier4 = getTieredCircuit(4);
        circuitTier5 = getTieredCircuit(5);
        circuitTier6 = getTieredCircuit(6);
        circuitTier7 = getTieredCircuit(7);
        circuitTier8 = getTieredCircuit(8);
        circuitTier9 = getTieredCircuit(9);
    }

    public static Object getTieredCircuit(int tier) {
        return getTieredCircuitOreDictName(tier);
    }

    public static String getTieredCircuitOreDictName(int tier) {
        if (tier == 0) {
            return "circuitPrimitive";
        } else if (tier == 1) {
            return "circuitBasic";
        } else if (tier == 2) {
            return "circuitGood";
        } else if (tier == 3) {
            return "circuitAdvanced";
        } else if (tier == 4) {
            return "circuitData";
        } else if (tier == 5) {
            return "circuitElite";
        } else if (tier == 6) {
            return "circuitMaster";
        } else if (tier == 7) {
            return "circuitUltimate";
        } else if (tier == 8) {
            return "circuitSuperconductor";
        } else if (tier == 9) {
            return "circuitInfinite";
        } else if (tier == 10) {
            return "circuitQuantum";
        } else {
            return "circuitPrimitive";
        }
    }

    private static Object getMaterialFromTier(int tier) {
        if (tier == 0) {
            return Materials.Wood;
        } else if (tier == 1) {
            return Materials.Lead;
        } else if (tier == 2) {
            return Materials.Bronze;
        } else if (tier == 3) {
            return Materials.Steel;
        } else if (tier == 4) {
            return MaterialsAlloy.EGLIN_STEEL;
        } else if (tier == 5) {
            return Materials.Aluminium;
        } else if (tier == 6) {
            return MaterialsAlloy.MARAGING250;
        } else if (tier == 7) {
            return MaterialsAlloy.TANTALLOY_61;
        } else if (tier == 8) {
            return MaterialsAlloy.INCONEL_792;
        } else if (tier == 9) {
            return MaterialsAlloy.ZERON_100;
        } else if (tier == 10) {
            return Materials.NaquadahEnriched;
        } else if (tier == 11) {
            return Materials.Neutronium;
        }
        return Materials._NULL;
    }

    public static String getTieredComponent(OrePrefixes type, int tier) {
        Object material = getMaterialFromTier(tier);
        if (material != null) {
            String materialName;
            if (material instanceof Materials) {
                // return (ItemStack) type.get(material);
                materialName = ((Materials) material).mDefaultLocalName;
                // return ItemUtils.getItemStackOfAmountFromOreDict(type.name()+materialName, 1);
            } else {
                materialName = (Utils.sanitizeString(((Material) material).getLocalizedName()));
                // return ItemUtils.getItemStackOfAmountFromOreDict(type.name()+materialName, 1);
            }
            Logger.INFO("Searching for a component named " + type.name() + materialName);
            return (type.name() + materialName);
        }
        Logger.INFO("[Components] Failed getting a tiered component. " + type.name() + " | " + tier);
        return null;
    }

    public static ItemStack getDataOrb() {
        return ItemList.Tool_DataOrb.get(1);
    }

    public static ItemStack getDataStick() {
        return ItemList.Tool_DataStick.get(1);
    }

    public static ItemStack getTieredMachineHull(int tier) {
        if (tier == 0) {
            return machineHull_ULV;
        } else if (tier == 1) {
            return machineHull_LV;
        } else if (tier == 2) {
            return machineHull_MV;
        } else if (tier == 3) {
            return machineHull_HV;
        } else if (tier == 4) {
            return machineHull_EV;
        } else if (tier == 5) {
            return machineHull_IV;
        } else if (tier == 6) {
            return machineHull_LuV;
        } else if (tier == 7) {
            return machineHull_ZPM;
        } else if (tier == 8) {
            return machineHull_UV;
        } else if (tier == 9) {
            return machineHull_UHV;
        } else {
            return GregtechItemList.Casing_Multi_Use.get(1);
        }
    }

    public static ItemStack getTieredMachineCasing(int tier) {
        if (tier == 0) {
            if (machineCasing_ULV == null) {
                machineCasing_ULV = ItemList.Casing_ULV.get(1);
            }
            return machineCasing_ULV;
        } else if (tier == 1) {
            return machineCasing_LV;
        } else if (tier == 2) {
            return machineCasing_MV;
        } else if (tier == 3) {
            return machineCasing_HV;
        } else if (tier == 4) {
            return machineCasing_EV;
        } else if (tier == 5) {
            return machineCasing_IV;
        } else if (tier == 6) {
            return machineCasing_LuV;
        } else if (tier == 7) {
            return machineCasing_ZPM;
        } else if (tier == 8) {
            return machineCasing_UV;
        } else if (tier == 9) {
            return machineCasing_UHV;
        } else {
            return GregtechItemList.Casing_Multi_Use.get(1);
        }
    }

    public static void init() {
        // Set Explosives
        explosivePowderKeg = ItemList.Block_Powderbarrel.get(1);
        explosiveTNT = ItemUtils.getSimpleStack(Blocks.tnt)
            .copy();
        explosiveITNT = Ic2Items.industrialTnt.copy();

        // Machine Casings
        machineCasing_ULV = ItemList.Casing_ULV.get(1);
        machineCasing_LV = ItemList.Casing_LV.get(1);
        machineCasing_MV = ItemList.Casing_MV.get(1);
        machineCasing_HV = ItemList.Casing_HV.get(1);
        machineCasing_EV = ItemList.Casing_EV.get(1);
        machineCasing_IV = ItemList.Casing_IV.get(1);
        machineCasing_LuV = ItemList.Casing_LuV.get(1);
        machineCasing_ZPM = ItemList.Casing_ZPM.get(1);
        machineCasing_UV = ItemList.Casing_UV.get(1);
        machineCasing_UHV = ItemList.Casing_MAX.get(1);

        // Machine Hulls
        machineHull_ULV = ItemList.Hull_ULV.get(1);
        machineHull_LV = ItemList.Hull_LV.get(1);
        machineHull_MV = ItemList.Hull_MV.get(1);
        machineHull_HV = ItemList.Hull_HV.get(1);
        machineHull_EV = ItemList.Hull_EV.get(1);
        machineHull_IV = ItemList.Hull_IV.get(1);
        machineHull_LuV = ItemList.Hull_LuV.get(1);
        machineHull_ZPM = ItemList.Hull_ZPM.get(1);
        machineHull_UV = ItemList.Hull_UV.get(1);
        machineHull_UHV = ItemList.Hull_MAX.get(1);

        // Gear box Casings
        gearboxCasing_Tier_1 = ItemList.Casing_Gearbox_Bronze.get(1);
        gearboxCasing_Tier_2 = ItemList.Casing_Gearbox_Steel.get(1);
        gearboxCasing_Tier_3 = ItemList.Casing_Gearbox_Titanium.get(1);
        gearboxCasing_Tier_4 = ItemList.Casing_Gearbox_TungstenSteel.get(1);

        // Machine Components
        LoaderMachineComponents.initialise();
    }

    public static ItemStack emptyCells(int i) {
        return ItemUtils.getEmptyCell(i);
    }

    private static final Material[] aMaterial_Main = new Material[] { MaterialsAlloy.POTIN, MaterialsAlloy.TUMBAGA,
        MaterialsAlloy.EGLIN_STEEL, MaterialsAlloy.TANTALUM_CARBIDE, MaterialsAlloy.INCOLOY_DS,
        MaterialsAlloy.INCONEL_625, MaterialsAlloy.ZERON_100, MaterialsAlloy.PIKYONIUM,
        MaterialsElements.STANDALONE.ADVANCED_NITINOL, MaterialsAlloy.ABYSSAL, MaterialsAlloy.QUANTUM,
        MaterialsElements.STANDALONE.HYPOGEN };

    private static final Material[] aMaterial_Secondary = new Material[] { MaterialsAlloy.STEEL,
        MaterialsAlloy.SILICON_CARBIDE, MaterialsAlloy.BLOODSTEEL, MaterialsAlloy.TANTALUM_CARBIDE,
        MaterialsAlloy.INCONEL_792, MaterialsAlloy.ARCANITE, MaterialsAlloy.LAFIUM, MaterialsAlloy.CINOBITE,
        MaterialsAlloy.TITANSTEEL, MaterialsAlloy.OCTIRON, MaterialsElements.STANDALONE.CELESTIAL_TUNGSTEN,
        MaterialsElements.STANDALONE.HYPOGEN };

    private static final Material[] aMaterial_Tertiary = new Material[] { MaterialsElements.getInstance().LEAD,
        MaterialsElements.getInstance().ALUMINIUM, MaterialsElements.STANDALONE.BLACK_METAL,
        MaterialsElements.getInstance().TITANIUM, MaterialsAlloy.HASTELLOY_N, MaterialsAlloy.ENERGYCRYSTAL,
        MaterialsAlloy.TRINIUM_NAQUADAH_CARBON, MaterialsAlloy.TRINIUM_REINFORCED_STEEL, // Arceus
        MaterialsAlloy.TITANSTEEL, MaterialsElements.STANDALONE.ASTRAL_TITANIUM,
        MaterialsElements.STANDALONE.CELESTIAL_TUNGSTEN, MaterialsElements.STANDALONE.HYPOGEN };

    private static final Materials[] aMaterial_Cables = new Materials[] { Materials.Tin, Materials.Cobalt,
        Materials.AnnealedCopper, Materials.Gold, Materials.Titanium, Materials.Nichrome, Materials.Platinum,
        Materials.YttriumBariumCuprate, Materials.Naquadah, Materials.Duranium, Materials.SuperconductorUHV, };

    private static final Materials[] aMaterial_Circuits = new Materials[] { Materials.ULV, Materials.LV, Materials.MV,
        Materials.HV, Materials.EV, Materials.IV, Materials.LuV, Materials.ZPM, Materials.UV, Materials.UHV,
        Materials.UEV, };

    private static final Material[][] aMaster = new Material[][] { aMaterial_Main, aMaterial_Secondary,
        aMaterial_Tertiary };

    public static FluidStack getTieredFluid(int aTier, int aAmount) {
        return getTieredFluid(aTier, aAmount, 0);
    }

    public static FluidStack getAlternativeTieredFluid(int aTier, int aAmount) {
        return getTieredFluid(aTier, aAmount, 1);
    }

    public static FluidStack getTertiaryTieredFluid(int aTier, int aAmount) {
        return getTieredFluid(aTier, aAmount, 2);
    }

    public static FluidStack getTieredFluid(int aTier, int aAmount, int aType) {
        FluidStack a = aMaster[aType][aTier].getFluidStack(aAmount);
        if (a == null) {
            ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1);
            if (aCell != null) {
                a = GTUtility.getFluidForFilledItem(aCell, true);
                a.amount = aAmount;
            }
        }
        return a;
    }

    public static ItemStack getEnergyCore(int aTier, int aAmount) {
        ItemStack[] aOutput = new ItemStack[] {
            ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore" + "1", 1),
            ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore" + "2", 1),
            ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore" + "3", 1),
            ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore" + "4", 1),
            ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore" + "5", 1),
            ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore" + "6", 1),
            ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore" + "7", 1),
            ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore" + "8", 1),
            ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore" + "9", 1),
            ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore" + "10", 1) };
        return ItemUtils.getSimpleStack(aOutput[MathUtils.balance(aTier, 0, 9)], aAmount);
    }

    public static ItemStack getPlate(int aTier, int aAmount) {
        return getTieredComponent(OrePrefixes.plate, aTier, aAmount);
    }

    public static ItemStack getDoublePlate(int aTier, int aAmount) {
        return getTieredComponent(OrePrefixes.plateDouble, aTier, aAmount);
    }

    public static ItemStack getGear(int aTier, int aAmount) {
        return getTieredComponent(OrePrefixes.gearGt, aTier, aAmount);
    }

    public static ItemStack getIngot(int aTier, int aAmount) {
        return getTieredComponent(OrePrefixes.ingot, aTier, aAmount);
    }

    public static ItemStack getBolt(int aTier, int aAmount) {
        return getTieredComponent(OrePrefixes.bolt, aTier, aAmount);
    }

    public static ItemStack getScrew(int aTier, int aAmount) {
        return getTieredComponent(OrePrefixes.screw, aTier, aAmount);
    }

    public static ItemStack getCircuit(int aTier, int aAmount) {
        return getTieredComponent(OrePrefixes.circuit, aTier, aAmount);
    }

    public static ItemStack getTieredComponent(OrePrefixes aPrefix, int aTier, int aAmount) {
        aTier = Math.max(0, aTier);

        Material m;

        if (aPrefix == OrePrefixes.liquid) {
            int aMatID = (aTier == 0 || aTier == 2 || aTier == 5 || aTier == 8 ? 0
                : (aTier == 1 || aTier == 3 || aTier == 6 || aTier == 9 ? 1 : 2));
            return aMaster[aMatID][aTier].getCell(aAmount);
        }

        if (aPrefix == OrePrefixes.circuit) {
            return GTOreDictUnificator.get(OrePrefixes.circuit, aMaterial_Circuits[aTier], aAmount);
        }

        // Check for Cables first, catch SuperConductor case and swap to wire.
        if (aPrefix == OrePrefixes.cableGt01 || aPrefix == OrePrefixes.cableGt02
            || aPrefix == OrePrefixes.cableGt04
            || aPrefix == OrePrefixes.cableGt08
            || aPrefix == OrePrefixes.cableGt12) {
            // Special Handler
            if (aTier == 10) {
                if (aPrefix == OrePrefixes.cableGt01) {
                    aPrefix = OrePrefixes.wireGt02;
                } else if (aPrefix == OrePrefixes.cableGt02) {
                    aPrefix = OrePrefixes.wireGt04;
                } else if (aPrefix == OrePrefixes.cableGt04) {
                    aPrefix = OrePrefixes.wireGt08;
                } else if (aPrefix == OrePrefixes.cableGt08) {
                    aPrefix = OrePrefixes.wireGt12;
                } else if (aPrefix == OrePrefixes.cableGt12) {
                    aPrefix = OrePrefixes.wireGt16;
                }
            } else {
                return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount);
            }
        }
        if (aPrefix == OrePrefixes.wireGt01 || aPrefix == OrePrefixes.wireGt02
            || aPrefix == OrePrefixes.wireGt04
            || aPrefix == OrePrefixes.wireGt08
            || aPrefix == OrePrefixes.wireGt12
            || aPrefix == OrePrefixes.wireGt16) {
            return ItemUtils.getOrePrefixStack(aPrefix, aMaterial_Cables[aTier], aAmount);
        }

        if (aPrefix == OrePrefixes.pipeTiny || aPrefix == OrePrefixes.pipeSmall
            || aPrefix == OrePrefixes.pipe
            || aPrefix == OrePrefixes.pipeMedium
            || aPrefix == OrePrefixes.pipeLarge
            || aPrefix == OrePrefixes.pipeHuge) {

            if (aPrefix == OrePrefixes.pipe) {
                aPrefix = OrePrefixes.pipeMedium;
            }

            if (aTier == 0) {
                return ItemUtils.getOrePrefixStack(aPrefix, Materials.Lead, aAmount);
            } else if (aTier == 1) {
                return ItemUtils.getOrePrefixStack(aPrefix, Materials.Steel, aAmount);
            } else if (aTier == 2) {
                return ItemUtils.getOrePrefixStack(aPrefix, Materials.StainlessSteel, aAmount);
            } else if (aTier == 3) {
                return ItemUtils.getOrePrefixStack(aPrefix, Materials.Tungsten, aAmount);
            } else if (aTier == 4) {
                return ItemUtils.getOrePrefixStack(aPrefix, Materials.TungstenSteel, aAmount);
            } else if (aTier == 5) {
                return ItemUtils.getOrePrefixStack(aPrefix, MaterialsAlloy.MARAGING350, aAmount);
            } else if (aTier == 6) {
                return ItemUtils.getOrePrefixStack(aPrefix, MaterialsAlloy.STABALLOY, aAmount);
            } else if (aTier == 7) {
                return ItemUtils.getOrePrefixStack(aPrefix, MaterialsAlloy.HASTELLOY_X, aAmount);
            } else if (aTier == 8) {
                return ItemUtils.getOrePrefixStack(aPrefix, Materials.Ultimate, aAmount);
            } else if (aTier == 9) {
                return ItemUtils.getOrePrefixStack(OrePrefixes.pipeMedium, Materials.SuperconductorUHV, aAmount);
            } else if (aTier == 10) {
                return ItemUtils.getOrePrefixStack(aPrefix, Materials.Europium, aAmount);
            } else {
                return ItemUtils.getOrePrefixStack(aPrefix, Materials.Titanium, aAmount);
            }
        }

        if (aPrefix == OrePrefixes.rod) {
            aPrefix = OrePrefixes.stick;
        }

        if (aPrefix == OrePrefixes.gear || aPrefix == OrePrefixes.gearGt) {
            m = aMaster[0][aTier];
        } else if (aPrefix == OrePrefixes.rod || aPrefix == OrePrefixes.stick) {
            m = aMaster[0][aTier];
        } else if (aPrefix == OrePrefixes.stickLong) {
            m = aMaster[1][aTier];
        } else if (aPrefix == OrePrefixes.bolt) {
            m = aMaster[2][aTier];
        } else if (aPrefix == OrePrefixes.screw) {
            m = aMaster[0][aTier];
        } else if (aPrefix == OrePrefixes.rotor) {
            m = aMaster[1][aTier];
        } else if (aPrefix == OrePrefixes.frame || aPrefix == OrePrefixes.frameGt) {
            m = aMaster[2][aTier];
        } else if (aPrefix == OrePrefixes.ingot) {
            m = aMaster[1][aTier];
        } else if (aPrefix == OrePrefixes.plate) {
            m = aMaster[0][aTier];
        } else if (aPrefix == OrePrefixes.plateDouble) {
            m = aMaster[0][aTier];
        } else if (aPrefix == OrePrefixes.ring) {
            m = aMaster[2][aTier];
        } else if (aPrefix == OrePrefixes.cell) {
            m = aMaster[1][aTier];
        } else {
            m = aMaterial_Main[aTier];
        }

        ItemStack aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount);

        // If Invalid, Try First Material
        if (!ItemUtils.checkForInvalidItems(aReturn)) {
            m = aMaster[0][aTier];
            aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount);

            // If Invalid, Try Second Material
            if (!ItemUtils.checkForInvalidItems(aReturn)) {
                m = aMaster[1][aTier];
                aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount);

                // If Invalid, Try Third Material
                if (!ItemUtils.checkForInvalidItems(aReturn)) {
                    m = aMaster[2][aTier];
                    aReturn = ItemUtils.getOrePrefixStack(aPrefix, m, aAmount);

                    // All Invalid?
                    // Let's add a special error ingot.
                    if (!ItemUtils.checkForInvalidItems(aReturn)) {
                        aReturn = ItemUtils.getErrorStack(1, (aPrefix + m.getLocalizedName() + " x" + aAmount));
                    }
                }
            }
        }

        return aReturn;
    }

    public static ItemStack getElectricMotor(int aTier, int aSize) {
        ItemStack aType;
        int aLazyTier = 1;
        if (aTier == aLazyTier++) {
            aType = CI.electricMotor_LV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricMotor_MV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricMotor_HV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricMotor_EV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricMotor_IV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricMotor_LuV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricMotor_ZPM;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricMotor_UV;
        } else if (aTier == aLazyTier) {
            aType = CI.electricMotor_UHV;
        } else {
            throw new IllegalArgumentException();
        }
        return ItemUtils.getSimpleStack(aType, aSize);
    }

    public static ItemStack getFluidRegulator(int aTier, int aSize) {
        ItemStack aType;
        int aLazyTier = 0;
        if (aTier == aLazyTier++) {
            aType = CI.fluidRegulator_LV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fluidRegulator_LV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fluidRegulator_MV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fluidRegulator_HV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fluidRegulator_EV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fluidRegulator_IV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fluidRegulator_LuV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fluidRegulator_ZPM;
        } else if (aTier == aLazyTier++) {
            aType = CI.fluidRegulator_UV;
        } else if (aTier == aLazyTier) {
            aType = CI.fluidRegulator_UV;
        } else {
            throw new IllegalArgumentException();
        }
        return ItemUtils.getSimpleStack(aType, aSize);
    }

    public static ItemStack getElectricPiston(int aTier, int aSize) {
        ItemStack aType;
        int aLazyTier = 1;
        if (aTier == aLazyTier++) {
            aType = CI.electricPiston_LV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPiston_MV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPiston_HV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPiston_EV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPiston_IV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPiston_LuV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPiston_ZPM;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPiston_UV;
        } else if (aTier == aLazyTier) {
            aType = CI.electricPiston_UHV;
        } else {
            throw new IllegalArgumentException();
        }
        return ItemUtils.getSimpleStack(aType, aSize);
    }

    public static ItemStack getElectricPump(int aTier, int aSize) {
        ItemStack aType;
        int aLazyTier = 1;
        if (aTier == aLazyTier++) {
            aType = CI.electricPump_LV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPump_MV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPump_HV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPump_EV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPump_IV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPump_LuV;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPump_ZPM;
        } else if (aTier == aLazyTier++) {
            aType = CI.electricPump_UV;
        } else if (aTier == aLazyTier) {
            aType = CI.electricPump_UHV;
        } else {
            throw new IllegalArgumentException();
        }
        return ItemUtils.getSimpleStack(aType, aSize);
    }

    public static ItemStack getRobotArm(int aTier, int aSize) {
        ItemStack aType;
        int aLazyTier = 1;
        if (aTier == aLazyTier++) {
            aType = CI.robotArm_LV;
        } else if (aTier == aLazyTier++) {
            aType = CI.robotArm_MV;
        } else if (aTier == aLazyTier++) {
            aType = CI.robotArm_HV;
        } else if (aTier == aLazyTier++) {
            aType = CI.robotArm_EV;
        } else if (aTier == aLazyTier++) {
            aType = CI.robotArm_IV;
        } else if (aTier == aLazyTier++) {
            aType = CI.robotArm_LuV;
        } else if (aTier == aLazyTier++) {
            aType = CI.robotArm_ZPM;
        } else if (aTier == aLazyTier++) {
            aType = CI.robotArm_UV;
        } else if (aTier == aLazyTier) {
            aType = CI.robotArm_UHV;
        } else {
            throw new IllegalArgumentException();
        }
        return ItemUtils.getSimpleStack(aType, aSize);
    }

    public static ItemStack getConveyor(int aTier, int aSize) {
        ItemStack aType;
        int aLazyTier = 1;
        if (aTier == aLazyTier++) {
            aType = CI.conveyorModule_LV;
        } else if (aTier == aLazyTier++) {
            aType = CI.conveyorModule_MV;
        } else if (aTier == aLazyTier++) {
            aType = CI.conveyorModule_HV;
        } else if (aTier == aLazyTier++) {
            aType = CI.conveyorModule_EV;
        } else if (aTier == aLazyTier++) {
            aType = CI.conveyorModule_IV;
        } else if (aTier == aLazyTier++) {
            aType = CI.conveyorModule_LuV;
        } else if (aTier == aLazyTier++) {
            aType = CI.conveyorModule_ZPM;
        } else if (aTier == aLazyTier++) {
            aType = CI.conveyorModule_UV;
        } else if (aTier == aLazyTier) {
            aType = CI.conveyorModule_UHV;
        } else {
            throw new IllegalArgumentException();
        }
        return ItemUtils.getSimpleStack(aType, aSize);
    }

    public static ItemStack getEmitter(int aTier, int aSize) {
        ItemStack aType;
        int aLazyTier = 1;
        if (aTier == aLazyTier++) {
            aType = CI.emitter_LV;
        } else if (aTier == aLazyTier++) {
            aType = CI.emitter_MV;
        } else if (aTier == aLazyTier++) {
            aType = CI.emitter_HV;
        } else if (aTier == aLazyTier++) {
            aType = CI.emitter_EV;
        } else if (aTier == aLazyTier++) {
            aType = CI.emitter_IV;
        } else if (aTier == aLazyTier++) {
            aType = CI.emitter_LuV;
        } else if (aTier == aLazyTier++) {
            aType = CI.emitter_ZPM;
        } else if (aTier == aLazyTier++) {
            aType = CI.emitter_UV;
        } else if (aTier == aLazyTier) {
            aType = CI.emitter_UHV;
        } else {
            throw new IllegalArgumentException();
        }
        return ItemUtils.getSimpleStack(aType, aSize);
    }

    public static ItemStack getSensor(int aTier, int aSize) {
        ItemStack aType;
        int aLazyTier = 1;
        if (aTier == aLazyTier++) {
            aType = CI.sensor_LV;
        } else if (aTier == aLazyTier++) {
            aType = CI.sensor_MV;
        } else if (aTier == aLazyTier++) {
            aType = CI.sensor_HV;
        } else if (aTier == aLazyTier++) {
            aType = CI.sensor_EV;
        } else if (aTier == aLazyTier++) {
            aType = CI.sensor_IV;
        } else if (aTier == aLazyTier++) {
            aType = CI.sensor_LuV;
        } else if (aTier == aLazyTier++) {
            aType = CI.sensor_ZPM;
        } else if (aTier == aLazyTier++) {
            aType = CI.sensor_UV;
        } else if (aTier == aLazyTier) {
            aType = CI.sensor_UHV;
        } else {
            throw new IllegalArgumentException();
        }
        return ItemUtils.getSimpleStack(aType, aSize);
    }

    public static ItemStack getFieldGenerator(int aTier, int aSize) {
        ItemStack aType;
        int aLazyTier = 1;
        if (aTier == aLazyTier++) {
            aType = CI.fieldGenerator_LV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fieldGenerator_MV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fieldGenerator_HV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fieldGenerator_EV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fieldGenerator_IV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fieldGenerator_LuV;
        } else if (aTier == aLazyTier++) {
            aType = CI.fieldGenerator_ZPM;
        } else if (aTier == aLazyTier++) {
            aType = CI.fieldGenerator_UV;
        } else if (aTier == aLazyTier) {
            aType = CI.fieldGenerator_UHV;
        } else {
            throw new IllegalArgumentException();
        }
        return ItemUtils.getSimpleStack(aType, aSize);
    }

    public static ItemStack getTieredMachineHull(int aTier, int aSize) {
        ItemStack aType;
        int aLazyTier = 0;
        if (aTier == aLazyTier++) {
            aType = CI.machineHull_ULV;
        } else if (aTier == aLazyTier++) {
            aType = CI.machineHull_LV;
        } else if (aTier == aLazyTier++) {
            aType = CI.machineHull_MV;
        } else if (aTier == aLazyTier++) {
            aType = CI.machineHull_HV;
        } else if (aTier == aLazyTier++) {
            aType = CI.machineHull_EV;
        } else if (aTier == aLazyTier++) {
            aType = CI.machineHull_IV;
        } else if (aTier == aLazyTier++) {
            aType = CI.machineHull_LuV;
        } else if (aTier == aLazyTier++) {
            aType = CI.machineHull_ZPM;
        } else if (aTier == aLazyTier++) {
            aType = CI.machineHull_UV;
        } else if (aTier == aLazyTier) {
            aType = CI.machineHull_UHV;
        } else {
            throw new IllegalArgumentException();
        }
        return ItemUtils.getSimpleStack(aType, aSize);
    }

    public static ItemStack getHeatCoil(int i) {
        if (i > 8) {
            i = 8;
        }
        return ItemUtils.simpleMetaStack(GregTechAPI.sBlockCasings5, i, 1);
    }

    public static ItemStack getNumberedBioCircuit(int i) {
        return ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, i, 0);
    }

    public static ItemStack getNumberedAdvancedCircuit(int i) {
        return ItemUtils.simpleMetaStack(GenericChem.mAdvancedCircuit, i, 0);
    }

    public static ItemStack getTieredGTPPMachineCasing(int aTier, int aAmount) {
        GregtechItemList[] aHulls = new GregtechItemList[] { GregtechItemList.GTPP_Casing_ULV,
            GregtechItemList.GTPP_Casing_LV, GregtechItemList.GTPP_Casing_MV, GregtechItemList.GTPP_Casing_HV,
            GregtechItemList.GTPP_Casing_EV, GregtechItemList.GTPP_Casing_IV, GregtechItemList.GTPP_Casing_LuV,
            GregtechItemList.GTPP_Casing_ZPM, GregtechItemList.GTPP_Casing_UV, GregtechItemList.GTPP_Casing_UHV };
        return aHulls[aTier].get(aAmount);
    }

    public static ItemStack getTieredComponentOfMaterial(Materials aMaterial, OrePrefixes aPrefix, int aAmount) {
        return ItemUtils.getOrePrefixStack(aPrefix, aMaterial, aAmount);
    }

    public static ItemStack getTransmissionComponent(int aTier, int aAmount) {
        GregtechItemList[] aTransParts = new GregtechItemList[] { null, GregtechItemList.TransmissionComponent_LV,
            GregtechItemList.TransmissionComponent_MV, GregtechItemList.TransmissionComponent_HV,
            GregtechItemList.TransmissionComponent_EV, GregtechItemList.TransmissionComponent_IV,
            GregtechItemList.TransmissionComponent_LuV, GregtechItemList.TransmissionComponent_ZPM,
            GregtechItemList.TransmissionComponent_UV, GregtechItemList.TransmissionComponent_UHV, };
        return aTransParts[aTier].get(aAmount);
    }

    public static ItemStack getEmptyCatalyst(int aAmount) {
        return ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 13, aAmount);
    }

    /**
     * Aluminium + Silver Catalyst
     *
     * @param aAmount - Stacksize
     * @return - A Catalyst stack of given size
     */
    public static ItemStack getGreenCatalyst(int aAmount) {
        return ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 14, aAmount);
    }

    /**
     * Iridium + Ruthenium Catalyst
     *
     * @param aAmount - Stacksize
     * @return - A Catalyst stack of given size
     */
    public static ItemStack getPurpleCatalyst(int aAmount) {
        return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 4, aAmount);
    }

    /**
     * Platinum + Rhodium Catalyst
     *
     * @param aAmount - Stacksize
     * @return - A Catalyst stack of given size
     */
    public static ItemStack getPinkCatalyst(int aAmount) {
        return ItemUtils.simpleMetaStack(GenericChem.mGenericChemItem1, 6, aAmount);
    }
}