forked from ReikaKalseki/DragonAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCoreModDetection.java
80 lines (65 loc) · 2.35 KB
/
CoreModDetection.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
69
70
71
72
73
74
75
76
77
78
79
80
/*******************************************************************************
* @author Reika Kalseki
*
* Copyright 2017
*
* All rights reserved.
* Distribution of the software in any form is only allowed with
* explicit, prior permission from the owner.
******************************************************************************/
package Reika.DragonAPI.Auxiliary;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.launchwrapper.Launch;
import Reika.DragonAPI.Libraries.Java.ReikaJavaLibrary;
public enum CoreModDetection {
OPTIFINE("optifine.OptiFineTweaker", "rendering and textures", ""),
LITELOADER("com.mumfrey.liteloader.core.LiteLoader", "sounds and textures", "Try reloading resources (F3+T) to fix this."),
FASTCRAFT(Launch.blackboard.get("fcVersion") != null, "render and block changes", ""),
VIVE("com.mtbs3d.minecrift.api.IRoomscaleAdapter", "rendering and interface", ""),
COLOREDLIGHTS("coloredlightscore.src.asm.ColoredLightsCoreLoadingPlugin", "rendering", "");
private final Class refClass;
private final boolean isLoaded;
private final String warning;
private final String message;
public static final CoreModDetection[] list = values();
private CoreModDetection(String s, String w, String m) {
this(ReikaJavaLibrary.getClassNoException(s), w, m);
}
private CoreModDetection(Class c, String w, String m) {
this(c, c != null, w, m);
}
private CoreModDetection(boolean flag, String w, String m) {
this(null, flag, w, m);
}
private CoreModDetection(Class c, boolean flag, String w, String m) {
refClass = c;
isLoaded = flag;
warning = w;
message = m;
}
public boolean isInstalled() {
return isLoaded;
}
static {
for (int i = 0; i < values().length; i++) {
CoreModDetection c = values()[i];
if (c.isInstalled()) {
ReikaJavaLibrary.pConsole("DRAGONAPI: "+c+" detected. Loading compatibility features.");
ReikaJavaLibrary.pConsole("\t\tNote that some parts of the game, especially "+c.warning+", may error out.");
ReikaJavaLibrary.pConsole("\t\t"+c.message);
}
else {
ReikaJavaLibrary.pConsole("DRAGONAPI: "+c+" not detected.");
}
}
}
public static String getStatus() {
Collection<CoreModDetection> li = new ArrayList();
for (CoreModDetection cm : list) {
if (cm.isInstalled())
li.add(cm);
}
return li.isEmpty() ? "None" : li.toString();
}
}