blob: 019af073f05b49bcc464809d3ff5eafe7f3242fc (
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
60
61
62
63
|
package gregtech.api.objects.overclockdescriber;
import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraft.util.EnumChatFormatting;
import gregtech.api.enums.GTValues;
import gregtech.api.util.GTRecipe;
import gregtech.api.util.GTUtility;
import gregtech.api.util.MethodsReturnNonnullByDefault;
import gregtech.api.util.OverclockCalculator;
import gregtech.nei.formatter.FusionSpecialValueFormatter;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class FusionOverclockDescriber extends EUOverclockDescriber {
protected final long capableStartup;
public FusionOverclockDescriber(byte energyTier, long capableStartup) {
super(energyTier, 1);
this.capableStartup = capableStartup;
}
@Override
public OverclockCalculator createCalculator(OverclockCalculator template, GTRecipe recipe) {
return super.createCalculator(template, recipe)
.limitOverclockCount(overclock(recipe.mSpecialValue, recipe.mEUt))
.setEUtIncreasePerOC(getEUtIncreasePerOC())
.setDurationDecreasePerOC(getDurationDecreasePerOC());
}
protected double getEUtIncreasePerOC() {
return 2.0;
}
protected double getDurationDecreasePerOC() {
return 2.0;
}
@Override
public String getTierString() {
return GTValues.TIER_COLORS[tier] + "MK " + getFusionTier() + EnumChatFormatting.RESET;
}
@Override
public boolean canHandle(GTRecipe recipe) {
byte tier = GTUtility.getTier(recipe.mEUt);
if (this.tier < tier) {
return false;
}
return this.capableStartup >= recipe.mSpecialValue;
}
protected int overclock(long startEnergy, long voltage) {
// Fusion Computer tier - recipe tier
return Math.max(getFusionTier() - FusionSpecialValueFormatter.getFusionTier(startEnergy, voltage), 0);
}
protected int getFusionTier() {
return this.tier - 5; // Mk1 <-> LuV
}
}
|