blob: 48c00dfe09afecca414f02c4c05b5c3298c17b48 (
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
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
|
package gregtech.api.util;
// import static gregtech.api.items.GT_MetaGenerated_Tool.getToolMaxDamage;
// import static gregtech.api.items.GT_MetaGenerated_Tool.getPrimaryMaterial;
// import gregtech.api.items.GT_MetaGenerated_Tool.getToolStats;
import net.minecraft.item.ItemStack;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.IToolStats;
import gregtech.api.items.MetaGeneratedTool;
public class TurbineStatCalculator {
public MetaGeneratedTool turbine;
public ItemStack item;
public long tMaxDamage;
public Materials tMaterial;
public IToolStats tStats;
public TurbineStatCalculator(MetaGeneratedTool turbineItem, ItemStack aStack) {
turbine = turbineItem;
item = aStack;
tMaxDamage = turbine.getToolMaxDamage(aStack);
tMaterial = turbine.getPrimaryMaterial(aStack);
tStats = turbine.getToolStats(aStack);
}
// Base stats
public long getMaxDurability() {
return tMaxDamage;
}
public long getCurrentDurability() {
return getMaxDurability() - turbine.getToolDamage(item);
}
// Efficiency in percentages
public float getEfficiency() {
return 0.5F + (0.5F + turbine.getToolCombatDamage(item)) * 0.1F;
}
public float getSteamEfficiency() {
return getEfficiency();
}
public float getGasEfficiency() {
return getEfficiency();
}
public float getPlasmaEfficiency() {
return getEfficiency();
}
public float getLooseEfficiency() {
// 0.85x - 0.3, where x is the base efficiency
return (float) (-0.2f + Math.round(getEfficiency() * 85.0f) * 0.01);
}
public float getLooseSteamEfficiency() {
return getLooseEfficiency() * 0.9f;
}
public float getLooseGasEfficiency() {
return getLooseEfficiency() * 0.95f;
}
public float getLoosePlasmaEfficiency() {
return getLooseEfficiency();
}
// Base optimal flows
public float getOptimalFlow() {
return tStats.getSpeedMultiplier() * tMaterial.mToolSpeed * 50F;
}
// All values are in EU/t before efficiency
public float getOptimalSteamFlow() {
return getOptimalFlow() * tMaterial.mSteamMultiplier;
}
public float getOptimalGasFlow() {
return getOptimalFlow() * tMaterial.mGasMultiplier;
}
public float getOptimalPlasmaFlow() {
return getOptimalFlow() * tMaterial.mPlasmaMultiplier * 42;
}
// Loose optimal flows
public float getOptimalLooseSteamFlow() {
// 3 * 1.1^((Efficiency - 0.8) * 20)
return 3.0f * getOptimalSteamFlow() * (float) Math.pow(1.1f, ((getEfficiency() - 0.8f)) * 20f);
}
public float getOptimalLooseGasFlow() {
// 2 * 1.05^((Efficiency - 0.8) * 20)
return 2.0f * getOptimalGasFlow() * (float) Math.pow(1.05f, ((getEfficiency() - 0.8f)) * 20f);
}
public float getOptimalLoosePlasmaFlow() {
// 1 * 1.05^((Efficiency - 0.8) * 20)
return 2.0f * getOptimalPlasmaFlow() * (float) Math.pow(1.03f, ((getEfficiency() - 0.8f)) * 20f);
}
// Base EU/t from optimal flow
public float getOptimalSteamEUt() {
return getOptimalSteamFlow() * getSteamEfficiency() * 0.5f;
}
public float getOptimalGasEUt() {
return getOptimalGasFlow() * getGasEfficiency();
}
public float getOptimalPlasmaEUt() {
return getOptimalPlasmaFlow() * getPlasmaEfficiency();
}
// Loose EU/t from optimal flow
public float getOptimalLooseSteamEUt() {
return getOptimalLooseSteamFlow() * getLooseSteamEfficiency() * 0.5f;
}
public float getOptimalLooseGasEUt() {
return getOptimalLooseGasFlow() * getLooseGasEfficiency();
}
public float getOptimalLoosePlasmaEUt() {
return getOptimalLoosePlasmaFlow() * getLoosePlasmaEfficiency();
}
public int getOverflowEfficiency() {
return (int) (1 + Math.min(2.0, tMaterial.mToolQuality / 3));
}
}
|