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
|
package gtPlusPlus.xmod.gregtech.loaders;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialStack;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.item.ItemUtils;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
public class RecipeGen_BlastSmelter implements Runnable{
final Material toGenerate;
public RecipeGen_BlastSmelter(final Material M){
this.toGenerate = M;
}
@Override
public void run() {
generateARecipe(toGenerate);
}
public static void generateARecipe(final Material M){
//Add a Blast Smelting Recipe, Let's go!
ItemStack tStack;
if (null != (tStack = M.getDust(1))) {
//Prepare some Variables
ItemStack[] components;
ArrayList<MaterialStack> tMaterial = new ArrayList<MaterialStack>();
short counter=0;
int inputStackCount=0;
int fluidAmount=0;
boolean doTest = true;
tMaterial = M.getComposites();
//This Bad boy here is what dictates unique recipes. Fuck life, right?
ItemStack circuitGT = ItemUtils.getGregtechCircuit(0);
//Set a duration
int duration = 0;
if (M.getMeltingPointK() > 150){
duration = (int) Math.max(M.getMass() / 50L, 1L) * M.getMeltingPointK();
}
else {
duration = (int) Math.max(M.getMass() / 50L, 1L) * 150;
}
int mMaterialListSize=0;
if (M.getComposites() != null){
for (gtPlusPlus.core.material.MaterialStack ternkfsdf : M.getComposites()){
if (ternkfsdf != null)
mMaterialListSize++;
}
}
else {
mMaterialListSize = 1;
}
Utils.LOG_WARNING("Size: "+mMaterialListSize);
//Make a simple one Material Materialstack[] and log it for validity.
circuitGT = ItemUtils.getGregtechCircuit(1);
ItemStack[] tItemStackTest = new ItemStack[]{circuitGT, tStack};
inputStackCount = 1;
fluidAmount = 144*inputStackCount;
Utils.LOG_WARNING("Adding an Alloy Blast Smelter Recipe for "+M.getLocalizedName()+". Gives "+fluidAmount+"L of molten metal.");
for (int das=0;das<tItemStackTest.length;das++){
if (tItemStackTest[das] != null)
Utils.LOG_WARNING("tMaterial["+das+"]: "+tItemStackTest[das].getDisplayName()+" Meta: "+tItemStackTest[das].getItemDamage()+", Amount: "+tItemStackTest[das].stackSize);
}
//Generate Recipes for all singular materials that can be made molten.
if (mMaterialListSize >= 1){
if (M.requiresBlastFurnace()) {
if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration, 240)){
Utils.LOG_WARNING("Success.");
if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0), M.getFluid(144), M.getIngot(1), duration, 120)){
Utils.LOG_INFO("Success, Also added a Fluid solidifier recipe.");
if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluid(144), 100, duration, 120)){
Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe.");
}
if (GT_Values.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+M.getUnlocalizedName(), 1), null, M.getFluid(16), 100, duration/9, 120)){
Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe.");
}
if (GT_Values.RA.addFluidExtractionRecipe(M.getSmallDust(1), null, M.getFluid(36), 100, duration/4, 120)){
Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe.");
}
if (GT_Values.RA.addFluidExtractionRecipe(M.getTinyDust(1), null, M.getFluid(16), 100, duration/9, 120)){
Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe.");
}
}
}
}
else {
Utils.LOG_WARNING("Failed.");
}
}
else {
if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration/2, 120)){
Utils.LOG_WARNING("Success.");
if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0), M.getFluid(144), M.getIngot(1), duration/2, 60)){
Utils.LOG_INFO("Success, Also added a Fluid solidifier recipe.");
if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluid(144), 100, duration/2, 60)){
Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe.");
}
ItemStack tempitem = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+M.getUnlocalizedName(), 1);
if (tempitem != null){
if (GT_Values.RA.addFluidExtractionRecipe(tempitem, null, M.getFluid(16), 100, duration/2/9, 60)){
Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe.");
}
}
if (GT_Values.RA.addFluidExtractionRecipe(M.getSmallDust(1), null, M.getFluid(36), 100, duration/2/4, 60)){
Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe.");
}
if (GT_Values.RA.addFluidExtractionRecipe(M.getTinyDust(1), null, M.getFluid(16), 100, duration/2/9, 60)){
Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe.");
}
}
}
else {
Utils.LOG_WARNING("Failed.");
}
}
if (tMaterial != null){
//Reset the Variables for compounds if last recipe was a success.
inputStackCount=0;
counter=0;
//If this Material has some kind of compound list, proceed
if (mMaterialListSize > 1){
gtPlusPlus.core.material.MaterialStack[] tempStack = new gtPlusPlus.core.material.MaterialStack[mMaterialListSize];
circuitGT = ItemUtils.getGregtechCircuit(mMaterialListSize);
//Just double checking
if (tempStack.length > 1){
//Builds me a MaterialStack[] from the MaterialList of M.
int ooo=0;
for (gtPlusPlus.core.material.MaterialStack xMaterial : M.getComposites()){
if (xMaterial != null){
if (xMaterial.getStackMaterial() != null){
Utils.LOG_WARNING("FOUND: "+xMaterial.getStackMaterial().getLocalizedName());
Utils.LOG_WARNING("ADDING: "+xMaterial.getStackMaterial().getLocalizedName());
}
tempStack[ooo] = xMaterial;
}
ooo++;
}
//Builds me an ItemStack[] of the materials. - Without a circuit - this gets a good count for the 144L fluid multiplier
components = new ItemStack[9];
inputStackCount=0;
for (int irc=0;irc<M.getComposites().size();irc++){
if (M.getComposites().get(irc) != null){
int r = (int) M.vSmallestRatio[irc];
inputStackCount = inputStackCount+r;
components[irc] = M.getComposites().get(irc).getDustStack(r);
}
}
//Adds a circuit
if (mMaterialListSize < 9 && mMaterialListSize != 0){
ItemStack[] components_NoCircuit = components;
//Builds me an ItemStack[] of the materials. - With a circuit
components = new ItemStack[components_NoCircuit.length+1];
for (int fr=0;fr<components.length;fr++){
if (fr==0){
components[0] = circuitGT;
}
else {
components[fr] = components_NoCircuit[fr-1];
}
}
Utils.LOG_INFO("Should have added a circuit. mMaterialListSize: "+mMaterialListSize+" | circuit: "+components[0].getDisplayName());
}
else {
Utils.LOG_INFO("Did not add a circuit. mMaterialListSize: "+mMaterialListSize);
}
//Set Fluid output
fluidAmount = 144*inputStackCount;
Utils.LOG_INFO("Adding an Alloy Blast Smelter Recipe for "+M.getLocalizedName()+" using it's compound dusts. This material has "+ inputStackCount+" parts. Gives "+fluidAmount+"L of molten metal.");
Utils.LOG_INFO("tMaterial.length: "+components.length+".");
for (int das=0;das<components.length;das++){
if (components[das] != null)
Utils.LOG_INFO("tMaterial["+das+"]: "+components[das].getDisplayName()+" Meta: "+components[das].getItemDamage()+", Amount: "+components[das].stackSize);
}
//Adds Recipe
if (M.requiresBlastFurnace()) {
if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 500)){
Utils.LOG_WARNING("Success.");
}
else {
Utils.LOG_WARNING("Failed.");
}
}
else {
if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 240)){
Utils.LOG_WARNING("Success.");
}
else {
Utils.LOG_WARNING("Failed.");
}
}
}
}
}
else {
Utils.LOG_WARNING("doTest: "+doTest+" | tMaterial != null: "+(tMaterial != null));
}
}
}
}
|