blob: eb77fba07253eab6a4933e1eac7e63358083d8be (
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
|
package gregtech.nei.formatter;
import java.util.Collections;
import java.util.List;
import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraft.util.StatCollector;
import gregtech.api.enums.GTValues;
import gregtech.api.util.GTUtility;
import gregtech.api.util.MethodsReturnNonnullByDefault;
import gregtech.nei.RecipeDisplayInfo;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class FusionSpecialValueFormatter implements INEISpecialInfoFormatter {
public static final FusionSpecialValueFormatter INSTANCE = new FusionSpecialValueFormatter();
private static final long M = 1000000;
@Override
public List<String> format(RecipeDisplayInfo recipeInfo) {
int euToStart = recipeInfo.recipe.mSpecialValue;
int voltage = recipeInfo.recipe.mEUt;
int tier = getFusionTier(euToStart, voltage);
return Collections.singletonList(
StatCollector.translateToLocalFormatted("GT5U.nei.start_eu", GTUtility.formatNumbers(euToStart), tier));
}
public static int getFusionTier(long 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 if (startupPower <= 320 * M * 16) {
tier = 4;
} else {
tier = 5;
}
if (voltage <= GTValues.V[6]) {
// no-op
} else if (voltage <= GTValues.V[7]) {
tier = Math.max(tier, 2);
} else if (voltage <= GTValues.V[8]) {
tier = Math.max(tier, 3);
} else if (voltage <= GTValues.V[9]) {
tier = Math.max(tier, 4);
} else {
tier = 5;
}
return tier;
}
}
|