-
Notifications
You must be signed in to change notification settings - Fork 211
Expand file tree
/
Copy pathGTValues.java
More file actions
220 lines (183 loc) · 8.65 KB
/
GTValues.java
File metadata and controls
220 lines (183 loc) · 8.65 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
package gregtech.api;
import gregtech.api.util.GTUtility;
import gregtech.api.util.random.XoShiRo256PlusPlusRandom;
import gregtech.common.ConfigHolder;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import net.minecraftforge.oredict.OreDictionary;
import java.time.MonthDay;
import java.util.Random;
import java.util.function.Supplier;
import static net.minecraft.util.text.TextFormatting.*;
/**
* Made for static imports, this Class is just a Helper.
*/
public class GTValues {
/**
* <p/>
* This is worth exactly one normal Item.
* This Constant can be divided by many commonly used Numbers such as
* 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, ... 64 or 81
* without loosing precision and is for that reason used as Unit of Amount.
* But it is also small enough to be multiplied with larger Numbers.
* <p/>
* This is used to determine the amount of Material contained inside a prefixed Ore.
* For example Nugget = M / 9 as it contains out of 1/9 of an Ingot.
*/
public static final long M = 3628800;
/**
* Renamed from "FLUID_MATERIAL_UNIT" to just "L"
* <p/>
* Fluid per Material Unit (Prime Factors: 3 * 3 * 2 * 2 * 2 * 2)
*/
public static final int L = 144;
/**
* The Item WildCard Tag. Even shorter than the "-1" of the past
*/
public static final short W = OreDictionary.WILDCARD_VALUE;
public static final Random RNG = new XoShiRo256PlusPlusRandom();
/** Current time on the Client. Will always be zero on the server. */
public static long CLIENT_TIME = 0;
/**
* The Voltage Tiers. Use this Array instead of the old named Voltage Variables
*/
public static final long[] V = { 8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432,
134217728, 536870912, 2147483648L };
/**
* The Voltage Tiers divided by 2.
*/
public static final int[] VH = { 4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216,
67108864, 268435456, 1073741824 };
/**
* The Voltage Tiers adjusted for cable loss. Use this for recipe EU/t to avoid full-amp recipes
*/
public static final int[] VA = { 7, 30, 120, 480, 1920, 7680, 30720, 122880, 491520, 1966080, 7864320, 31457280,
125829120, 503316480, 2013265920 };
/**
* The Voltage Tiers adjusted for cable loss, divided by 2.
*/
public static final int[] VHA = { 4, 16, 60, 240, 960, 3840, 15360, 61440, 245760, 983040, 3932160, 15728640,
62914560, 251658240, 1006632960 };
/**
* The Voltage Tiers extended all the way to max Long value for overclocking
*/
public static final long[] VOC = { 8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432,
134217728, 536870912, 2147483648L, 8589934592L, 34359738368L, 137438953472L, 549755813888L,
2199023255552L, 8796093022208L, 35184372088832L, 140737488355328L, 562949953421312L, 2251799813685248L,
9007199254740992L, 36028797018963968L, 144115188075855872L, 576460752303423488L, 2305843009213693952L,
Long.MAX_VALUE };
public static final long[] VAOC = { 7, 30, 120, 480, 1920, 7680, 30720, 123880, 491520, 1966080, 7864320,
31457280, 125829120, 503316480, 2013265920, 8053063680L, 32212254720L, 128849018880L, 515396075520L,
2061584302080L, 8246337208320L, 32985348833280L, 131948427333120L, 527865581332480L, 2111062325297920L,
8444249301319680L, 33777097205278720L, 135108988821415880L, 540431751284459520L, 2161727821137838080L,
8646911284550352320L
};
public static final int ULV = 0;
public static final int LV = 1;
public static final int MV = 2;
public static final int HV = 3;
public static final int EV = 4;
public static final int IV = 5;
public static final int LuV = 6;
public static final int ZPM = 7;
public static final int UV = 8;
public static final int UHV = 9;
public static final int UEV = 10;
public static final int UIV = 11;
public static final int UXV = 12;
public static final int OpV = 13;
public static final int MAX = 14;
public static final int MAX_TRUE = 30;
/**
* The short names for the voltages, used for registration primarily
*/
public static final String[] VN = new String[] { "ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV",
"UEV", "UIV", "UXV", "OpV", "MAX" };
/**
* The short names for the voltages, up to max Long, used for registration primarily
*/
public static final String[] VOCN = new String[] { "ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV",
"UEV", "UIV", "UXV", "OpV", "MAX", "MAX+1", "MAX+2", "MAX+3", "MAX+4", "MAX+5", "MAX+6", "MAX+7", "MAX+8",
"MAX+9", "MAX+10", "MAX+11", "MAX+12", "MAX+13", "MAX+14", "MAX+15", "MAX+16",
};
/**
* The short names for the voltages, formatted for text
*/
public static final String[] VNF = new String[] {
DARK_GRAY + "ULV", GRAY + "LV", AQUA + "MV",
GOLD + "HV", DARK_PURPLE + "EV", BLUE + "IV",
LIGHT_PURPLE + "LuV", RED + "ZPM", DARK_AQUA + "UV",
DARK_RED + "UHV", GREEN + "UEV", DARK_GREEN + "UIV",
YELLOW + "UXV", BLUE.toString() + BOLD + "OpV", RED.toString() + BOLD + "MAX" };
private static final String MAX_PLUS = RED.toString() + BOLD + "M" + YELLOW + BOLD + "A" + GREEN + BOLD + "X" +
AQUA + BOLD + "+" + LIGHT_PURPLE + BOLD;
/**
* The short names for the voltages, up to max Long, formatted for text
*/
public static final String[] VOCNF = new String[] {
DARK_GRAY + "ULV", GRAY + "LV", AQUA + "MV",
GOLD + "HV", DARK_PURPLE + "EV", BLUE + "IV",
LIGHT_PURPLE + "LuV", RED + "ZPM", DARK_AQUA + "UV",
DARK_RED + "UHV", GREEN + "UEV", DARK_GREEN + "UIV",
YELLOW + "UXV", BLUE.toString() + BOLD + "OpV", RED.toString() + BOLD + "MAX",
MAX_PLUS + "1", MAX_PLUS + "2", MAX_PLUS + "3", MAX_PLUS + "4",
MAX_PLUS + "5", MAX_PLUS + "6", MAX_PLUS + "7", MAX_PLUS + "8",
MAX_PLUS + "9", MAX_PLUS + "10", MAX_PLUS + "11", MAX_PLUS + "12",
MAX_PLUS + "13", MAX_PLUS + "14", MAX_PLUS + "15", MAX_PLUS + "16", };
/**
* Color values for the voltages
*/
public static final int[] VC = new int[] { 0xC80000, 0xDCDCDC, 0xFF6400, 0xFFFF1E, 0x808080, 0xF0F0F5, 0xE99797,
0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x914E91, 0x488748, 0x8C0000, 0x2828F5 };
/**
* The long names for the voltages
*/
public static final String[] VOLTAGE_NAMES = new String[] { "Ultra Low Voltage", "Low Voltage", "Medium Voltage",
"High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage",
"Ultra High Voltage", "Ultra Excessive Voltage", "Ultra Immense Voltage", "Ultra Extreme Voltage",
"Overpowered Voltage", "Maximum Voltage" };
/**
* GregTech Mod ID
*/
public static final String MODID = "gregtech";
/**
* GregTech Mod Name
*/
public static final String MOD_NAME = "GregTech";
private static Boolean isClient;
public static boolean isClientSide() {
if (isClient == null) isClient = FMLCommonHandler.instance().getSide().isClient();
return isClient;
}
private static Boolean isDeobf;
public static boolean isDeobfEnvironment() {
if (isDeobf == null) isDeobf = FMLLaunchHandler.isDeobfuscatedEnvironment();
return isDeobf;
}
/**
* Default fallback value used for Map keys.
* Currently only used in {@link gregtech.loaders.recipe.CraftingComponent}.
*/
public static final int FALLBACK = -1;
public static final MonthDay DAY_APRIL_FOOLS = MonthDay.of(4, 1);
public static final MonthDay DAY_XMAS_EVE = MonthDay.of(12, 24);
public static final MonthDay DAY_XMAS = MonthDay.of(12, 25);
/**
* Check if today is April 1st.
*/
public static boolean isAprilFools() {
if (!ConfigHolder.misc.specialEvents) return false;
return GTUtility.isToday(DAY_APRIL_FOOLS);
}
/**
* Check if today is the day of, or eve of Xmas.
*/
public static boolean isXMAS() {
if (!ConfigHolder.misc.specialEvents) return false;
return GTUtility.isToday(DAY_XMAS_EVE) || GTUtility.isToday(DAY_XMAS);
}
@Deprecated
public static final Supplier<Boolean> FOOLS = GTValues::isAprilFools;
@Deprecated
public static final Supplier<Boolean> XMAS = GTValues::isXMAS;
}