/
Internal.java
68 lines (54 loc) · 1.64 KB
/
Internal.java
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
package mezz.jei;
import javax.annotation.Nullable;
import mezz.jei.util.StackHelper;
import mezz.jei.util.color.ColorNamer;
/** For JEI internal use only, these are normally accessed from the API. */
public class Internal {
private static JeiHelpers helpers = new JeiHelpers();
@Nullable
private static JeiRuntime runtime;
@Nullable
private static IngredientRegistry ingredientRegistry;
@Nullable
private static ColorNamer colorNamer;
private Internal() {
}
public static JeiHelpers getHelpers() {
return helpers;
}
public static void setHelpers(JeiHelpers helpers) {
Internal.helpers = helpers;
}
public static StackHelper getStackHelper() {
return helpers.getStackHelper();
}
@Nullable
public static JeiRuntime getRuntime() {
return runtime;
}
public static void setRuntime(JeiRuntime runtime) {
JeiRuntime jeiRuntime = Internal.runtime;
if (jeiRuntime != null) {
jeiRuntime.close();
}
Internal.runtime = runtime;
}
public static IngredientRegistry getIngredientRegistry() {
if (ingredientRegistry == null) {
throw new IllegalStateException("Ingredient Registry has not been created yet.");
}
return ingredientRegistry;
}
public static void setIngredientRegistry(@Nullable IngredientRegistry ingredientRegistry) {
Internal.ingredientRegistry = ingredientRegistry;
}
public static ColorNamer getColorNamer() {
if (colorNamer == null) {
throw new IllegalStateException("Color Namer has not been created yet.");
}
return colorNamer;
}
public static void setColorNamer(ColorNamer colorNamer) {
Internal.colorNamer = colorNamer;
}
}