-
Notifications
You must be signed in to change notification settings - Fork 755
/
EnvironmentChecks.java
85 lines (72 loc) · 2.84 KB
/
EnvironmentChecks.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
81
82
83
84
85
package tconstruct.util;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.ICrashCallable;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import java.util.ArrayList;
import java.util.List;
import tconstruct.TConstruct;
public class EnvironmentChecks
{
// Used for aborting cloak renders with Optifine present (it misbehaves)
public static boolean hasOptifine = false;
private EnvironmentChecks()
{
} // Singleton
/**
* Checks for conflicting stuff in environment; adds callable to any crash logs if so.
* Note: This code adds additional data to crashlogs. It does not trigger any crashes.
*/
public static void verifyEnvironmentSanity ()
{
List<String> modIds = new ArrayList<String>();
if (Loader.isModLoaded("gregtech_addon"))
{
TConstruct.logger.severe("[Environment Checks] Gelatinous iceberg dead ahead! Entering Greggy waters! Abandon hope all ye who enter here! (No, seriously, we don't support GT. Don't report any issues. Thanks.)");
modIds.add("gregtech_addon");
}
if (FMLCommonHandler.instance().getSide() == Side.CLIENT && FMLClientHandler.instance().hasOptifine() || Loader.isModLoaded("optifine"))
{
TConstruct.logger.severe("[Environment Checks] Optifine detected. This is a Bad Thing(tm) and can crash Minecraft due to an Optifine bug during TCon armor renders! Capes also disabled.");
modIds.add("optifine");
hasOptifine = true;
}
try
{
Class cl = Class.forName("org.bukkit.Bukkit");
if (cl != null)
{
TConstruct.logger.severe("[Environment Checks] Bukkit implementation detected. This may be crashy. Bukkit implementations include Craftbukkit and MCPC+.");
modIds.add("bukkit");
}
}
catch (Exception ex)
{
// No Bukkit in environment.
}
try
{
Class cl = Class.forName("magic.launcher.Launcher");
if (cl != null)
{
TConstruct.logger.severe("[Environment Checks] Magic Launcher detected. We recommend using anything else. Vanilla's launcher works fine, as do others.");
modIds.add("magic_launcher");
}
}
catch (Exception ex)
{
// No derpy Magic Launcher in environment.
}
if (modIds.size() == 0)
{
ICrashCallable callable = new CallableSuppConfig();
FMLCommonHandler.instance().registerCrashCallable(callable);
}
else
{
ICrashCallable callable = new CallableUnsuppConfig(modIds);
FMLCommonHandler.instance().registerCrashCallable(callable);
}
}
}