-
Notifications
You must be signed in to change notification settings - Fork 211
Expand file tree
/
Copy pathBlastProperty.java
More file actions
221 lines (180 loc) · 6.6 KB
/
Copy pathBlastProperty.java
File metadata and controls
221 lines (180 loc) · 6.6 KB
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
package gregtech.api.unification.material.properties;
import gregtech.integration.groovy.GroovyScriptModule;
import crafttweaker.CraftTweakerAPI;
import org.jetbrains.annotations.NotNull;
public class BlastProperty implements IMaterialProperty {
/**
* Blast Furnace Temperature of this Material. If below 1000K, Primitive Blast Furnace recipes will be also added.
* If above 1750K, a Hot Ingot and its Vacuum Freezer recipe will be also added.
* <p>
* If a Material with this Property has a Fluid, its temperature will be set to this if it is the default Fluid
* temperature.
*/
private int blastTemperature;
/**
* The {@link GasTier} of this Material, representing which Gas EBF recipes will be generated.
* <p>
* Default: null, meaning no Gas EBF recipes.
*/
private GasTier gasTier = null;
/**
* The duration of the EBF recipe, overriding the stock behavior.
* <p>
* Default: -1, meaning the duration will be: material.getAverageMass() * blastTemperature / 50
*/
private int durationOverride = -1;
/**
* The EU/t of the EBF recipe, overriding the stock behavior.
* <p>
* Default: -1, meaning the EU/t will be 120.
*/
private int eutOverride = -1;
/**
* The duration of the EBF recipe, overriding the stock behavior.
* <p>
* Default: -1, meaning the duration will be: material.getMass() * 3
*/
private int vacuumDurationOverride = -1;
/**
* The EU/t of the Vacuum Freezer recipe (if needed), overriding the stock behavior.
* <p>
* Default: -1, meaning the EU/t will be 120 EU/t.
*/
private int vacuumEUtOverride = -1;
public BlastProperty(int blastTemperature) {
this.blastTemperature = blastTemperature;
}
public BlastProperty(int blastTemperature, GasTier gasTier) {
this.blastTemperature = blastTemperature;
this.gasTier = gasTier;
}
private BlastProperty(int blastTemperature, GasTier gasTier, int eutOverride, int durationOverride,
int vacuumEUtOverride, int vacuumDurationOverride) {
this.blastTemperature = blastTemperature;
this.gasTier = gasTier;
this.eutOverride = eutOverride;
this.durationOverride = durationOverride;
this.vacuumEUtOverride = vacuumEUtOverride;
this.vacuumDurationOverride = vacuumDurationOverride;
}
/**
* Default property constructor.
*/
public BlastProperty() {
this(0);
}
public int getBlastTemperature() {
return blastTemperature;
}
public BlastProperty setBlastTemperature(int blastTemp) {
if (blastTemp <= 0) throw new IllegalArgumentException("Blast Temperature must be greater than zero!");
this.blastTemperature = blastTemp;
return this;
}
public GasTier getGasTier() {
return gasTier;
}
public BlastProperty setGasTier(@NotNull GasTier tier) {
this.gasTier = tier;
return this;
}
public int getDurationOverride() {
return durationOverride;
}
public BlastProperty setDurationOverride(int duration) {
this.durationOverride = duration;
return this;
}
public int getEUtOverride() {
return eutOverride;
}
public BlastProperty setEutOverride(int eut) {
this.eutOverride = eut;
return this;
}
public int getVacuumDurationOverride() {
return vacuumDurationOverride;
}
public BlastProperty setVacuumDurationOverride(int duration) {
this.vacuumDurationOverride = duration;
return this;
}
public int getVacuumEUtOverride() {
return vacuumEUtOverride;
}
public BlastProperty setVacuumEutOverride(int eut) {
this.vacuumEUtOverride = eut;
return this;
}
@Override
public void verifyProperty(MaterialProperties properties) {
properties.ensureSet(PropertyKey.INGOT, true);
}
public static GasTier validateGasTier(String gasTierName) {
if (gasTierName == null) return null;
if (GroovyScriptModule.isCurrentlyRunning()) {
return GroovyScriptModule.parseAndValidateEnumValue(GasTier.class, gasTierName, "gas tier");
}
if ("LOW".equalsIgnoreCase(gasTierName)) return GasTier.LOW;
else if ("MID".equalsIgnoreCase(gasTierName)) return GasTier.MID;
else if ("HIGH".equalsIgnoreCase(gasTierName)) return GasTier.HIGH;
else if ("HIGHER".equalsIgnoreCase(gasTierName)) return GasTier.HIGHER;
else if ("HIGHEST".equalsIgnoreCase(gasTierName)) return GasTier.HIGHEST;
else {
String message = "Gas Tier must be either \"LOW\", \"MID\", \"HIGH\", \"HIGHER\", or \"HIGHEST\"";
CraftTweakerAPI.logError(message);
throw new IllegalArgumentException(
"Could not find valid gas tier for name: " + gasTierName + ". " + message);
}
}
public enum GasTier {
// Tiers used by GTCEu
LOW,
MID,
HIGH,
// Tiers reserved for addons
HIGHER,
HIGHEST;
public static final GasTier[] VALUES = values();
}
public static class Builder {
private int temp;
private GasTier gasTier;
private int eutOverride = -1;
private int durationOverride = -1;
private int vacuumEUtOverride = -1;
private int vacuumDurationOverride = -1;
public Builder() {}
public Builder temp(int temperature) {
this.temp = temperature;
return this;
}
public Builder temp(int temperature, GasTier gasTier) {
this.temp = temperature;
this.gasTier = gasTier;
return this;
}
public Builder blastStats(int eutOverride) {
this.eutOverride = eutOverride;
return this;
}
public Builder blastStats(int eutOverride, int durationOverride) {
this.eutOverride = eutOverride;
this.durationOverride = durationOverride;
return this;
}
public Builder vacuumStats(int eutOverride) {
this.vacuumEUtOverride = eutOverride;
return this;
}
public Builder vacuumStats(int eutOverride, int durationOverride) {
this.vacuumEUtOverride = eutOverride;
this.vacuumDurationOverride = durationOverride;
return this;
}
public BlastProperty build() {
return new BlastProperty(temp, gasTier, eutOverride, durationOverride, vacuumEUtOverride,
vacuumDurationOverride);
}
}
}