blob: 0d5517b6f03741d6f769e3e08a15338c580725bc (
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
|
package gregtech.nei;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import gregtech.api.enums.GT_Values;
public class FusionSpecialValueFormatter implements INEISpecialInfoFormatter {
public static final FusionSpecialValueFormatter INSTANCE = new FusionSpecialValueFormatter();
private static final int M = 1000000;
@Override
public List<String> format(NEIRecipeInfo recipeInfo, Function<Integer, String> applyPrefixAndSuffix) {
int euToStart = recipeInfo.recipe.mSpecialValue;
int voltage = recipeInfo.recipe.mEUt;
int tier = getFusionTier(euToStart, voltage);
return Collections.singletonList(applyPrefixAndSuffix.apply(euToStart) + " (MK " + tier + ")");
}
public static int getFusionTier(int startupPower, long voltage) {
int tier;
if (startupPower <= 10 * M * 16) {
tier = 1;
} else if (startupPower <= 20 * M * 16) {
tier = 2;
} else if (startupPower <= 40 * M * 16) {
tier = 3;
} else {
tier = 4;
}
if (voltage <= GT_Values.V[6]) {
// no-op
} else if (voltage <= GT_Values.V[7]) {
tier = Math.max(tier, 2);
} else if (voltage <= GT_Values.V[8]) {
tier = Math.max(tier, 3);
} else {
tier = 4;
}
return tier;
}
}
|