-
Notifications
You must be signed in to change notification settings - Fork 755
/
TE4Helper.java
240 lines (171 loc) · 8.98 KB
/
TE4Helper.java
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
package tconstruct.plugins.te4;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import cpw.mods.fml.common.event.FMLInterModComms;
/**
* Taken from CoFHLib
*
* @author KingLemming
*/
public class TE4Helper
{
public static void addFurnaceRecipe(int energy, ItemStack input, ItemStack output) {
if (input == null || output == null) {
return;
}
NBTTagCompound toSend = new NBTTagCompound();
toSend.setInteger("energy", energy);
toSend.setTag("input", new NBTTagCompound());
toSend.setTag("output", new NBTTagCompound());
input.writeToNBT(toSend.getCompoundTag("input"));
output.writeToNBT(toSend.getCompoundTag("output"));
FMLInterModComms.sendMessage("ThermalExpansion", "FurnaceRecipe", toSend);
}
public static void addPulverizerRecipe(int energy, ItemStack input, ItemStack primaryOutput) {
addPulverizerRecipe(energy, input, primaryOutput, null, 0);
}
public static void addPulverizerRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput) {
addPulverizerRecipe(energy, input, primaryOutput, secondaryOutput, 100);
}
public static void addPulverizerRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) {
if (input == null || primaryOutput == null || secondaryOutput == null) {
return;
}
NBTTagCompound toSend = new NBTTagCompound();
toSend.setInteger("energy", energy);
toSend.setTag("input", new NBTTagCompound());
toSend.setTag("primaryOutput", new NBTTagCompound());
toSend.setTag("secondaryOutput", new NBTTagCompound());
input.writeToNBT(toSend.getCompoundTag("input"));
primaryOutput.writeToNBT(toSend.getCompoundTag("primaryOutput"));
secondaryOutput.writeToNBT(toSend.getCompoundTag("secondaryOutput"));
toSend.setInteger("secondaryChance", secondaryChance);
FMLInterModComms.sendMessage("ThermalExpansion", "PulverizerRecipe", toSend);
}
public static void addSawmillRecipe(int energy, ItemStack input, ItemStack primaryOutput) {
addSawmillRecipe(energy, input, primaryOutput, null, 0);
}
public static void addSawmillRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput) {
addSawmillRecipe(energy, input, primaryOutput, secondaryOutput, 100);
}
public static void addSawmillRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance) {
if (input == null || primaryOutput == null || secondaryOutput == null) {
return;
}
NBTTagCompound toSend = new NBTTagCompound();
toSend.setInteger("energy", energy);
toSend.setTag("input", new NBTTagCompound());
toSend.setTag("primaryOutput", new NBTTagCompound());
toSend.setTag("secondaryOutput", new NBTTagCompound());
input.writeToNBT(toSend.getCompoundTag("input"));
primaryOutput.writeToNBT(toSend.getCompoundTag("primaryOutput"));
secondaryOutput.writeToNBT(toSend.getCompoundTag("secondaryOutput"));
toSend.setInteger("secondaryChance", secondaryChance);
FMLInterModComms.sendMessage("ThermalExpansion", "SawmillRecipe", toSend);
}
public static void addSmelterRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput) {
addSmelterRecipe(energy, primaryInput, secondaryInput, primaryOutput, null, 0);
}
public static void addSmelterRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput, ItemStack secondaryOutput) {
addSmelterRecipe(energy, primaryInput, secondaryInput, primaryOutput, secondaryOutput, 100);
}
public static void addSmelterRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput, ItemStack secondaryOutput,
int secondaryChance) {
if (primaryInput == null || secondaryInput == null || primaryOutput == null || secondaryOutput == null) {
return;
}
NBTTagCompound toSend = new NBTTagCompound();
toSend.setInteger("energy", energy);
toSend.setTag("primaryInput", new NBTTagCompound());
toSend.setTag("secondaryInput", new NBTTagCompound());
toSend.setTag("primaryOutput", new NBTTagCompound());
toSend.setTag("secondaryOutput", new NBTTagCompound());
primaryInput.writeToNBT(toSend.getCompoundTag("primaryInput"));
secondaryInput.writeToNBT(toSend.getCompoundTag("secondaryInput"));
primaryOutput.writeToNBT(toSend.getCompoundTag("primaryOutput"));
secondaryOutput.writeToNBT(toSend.getCompoundTag("secondaryOutput"));
toSend.setInteger("secondaryChance", secondaryChance);
FMLInterModComms.sendMessage("ThermalExpansion", "SmelterRecipe", toSend);
}
/**
* Use this to register an Ore TYPE as a "Blast" recipe - it will require Pyrotheum Dust to smelt. Do not add the prefix. This is an opt-in for ores which
* do NOT have vanilla furnace recipes.
*
* Ex: "Steel" or "ElectrumFlux", not "dustSteel" or "dustElectrumFlux"
*
* @param oreType
*/
public static void addSmelterBlastOre(String oreType) {
NBTTagCompound toSend = new NBTTagCompound();
toSend.setString("oreType", oreType);
FMLInterModComms.sendMessage("ThermalExpansion", "SmelterBlastOreType", toSend);
}
public static void addCrucibleRecipe(int energy, ItemStack input, FluidStack output) {
if (input == null || output == null) {
return;
}
NBTTagCompound toSend = new NBTTagCompound();
toSend.setInteger("energy", energy);
toSend.setTag("input", new NBTTagCompound());
toSend.setTag("output", new NBTTagCompound());
input.writeToNBT(toSend.getCompoundTag("input"));
output.writeToNBT(toSend.getCompoundTag("output"));
FMLInterModComms.sendMessage("ThermalExpansion", "CrucibleRecipe", toSend);
}
public static void addTransposerFill(int energy, ItemStack input, ItemStack output, FluidStack fluid, boolean reversible) {
if (input == null || output == null || fluid == null) {
return;
}
NBTTagCompound toSend = new NBTTagCompound();
toSend.setInteger("energy", energy);
toSend.setTag("input", new NBTTagCompound());
toSend.setTag("output", new NBTTagCompound());
toSend.setTag("fluid", new NBTTagCompound());
input.writeToNBT(toSend.getCompoundTag("input"));
output.writeToNBT(toSend.getCompoundTag("output"));
toSend.setBoolean("reversible", reversible);
fluid.writeToNBT(toSend.getCompoundTag("fluid"));
FMLInterModComms.sendMessage("ThermalExpansion", "TransposerFillRecipe", toSend);
}
public static void addTransposerExtract(int energy, ItemStack input, ItemStack output, FluidStack fluid, int chance, boolean reversible) {
if (input == null || output == null || fluid == null) {
return;
}
NBTTagCompound toSend = new NBTTagCompound();
toSend.setInteger("energy", energy);
toSend.setTag("input", new NBTTagCompound());
toSend.setTag("output", new NBTTagCompound());
toSend.setTag("fluid", new NBTTagCompound());
input.writeToNBT(toSend.getCompoundTag("input"));
output.writeToNBT(toSend.getCompoundTag("output"));
toSend.setBoolean("reversible", reversible);
toSend.setInteger("chance", chance);
fluid.writeToNBT(toSend.getCompoundTag("fluid"));
FMLInterModComms.sendMessage("ThermalExpansion", "TransposerExtractRecipe", toSend);
}
public static void addMagmaticFuel(String fluidName, int energy) {
NBTTagCompound toSend = new NBTTagCompound();
toSend.setString("fluidName", fluidName);
toSend.setInteger("energy", energy);
FMLInterModComms.sendMessage("ThermalExpansion", "MagmaticFuel", toSend);
}
public static void addCompressionFuel(String fluidName, int energy) {
NBTTagCompound toSend = new NBTTagCompound();
toSend.setString("fluidName", fluidName);
toSend.setInteger("energy", energy);
FMLInterModComms.sendMessage("ThermalExpansion", "CompressionFuel", toSend);
}
public static void addReactantFuel(String fluidName, int energy) {
NBTTagCompound toSend = new NBTTagCompound();
toSend.setString("fluidName", fluidName);
toSend.setInteger("energy", energy);
FMLInterModComms.sendMessage("ThermalExpansion", "ReactantFuel", toSend);
}
public static void addCoolant(String fluidName, int energy) {
NBTTagCompound toSend = new NBTTagCompound();
toSend.setString("fluidName", fluidName);
toSend.setInteger("energy", energy);
FMLInterModComms.sendMessage("ThermalExpansion", "Coolant", toSend);
}
}