Files
TinkersConstruct/src/main/java/tconstruct/util/EnvironmentChecks.java
T

80 lines
2.7 KiB
Java
Raw Normal View History

2013-10-22 20:09:21 +01:00
package tconstruct.util;
2013-10-30 22:15:03 +00:00
import cpw.mods.fml.client.FMLClientHandler;
2013-10-22 20:09:21 +01:00
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.ICrashCallable;
import cpw.mods.fml.common.Loader;
2013-10-30 22:15:03 +00:00
import cpw.mods.fml.relauncher.Side;
import tconstruct.TConstruct;
2013-10-22 20:09:21 +01:00
import java.util.ArrayList;
import java.util.List;
2013-11-10 13:57:35 -08:00
public class EnvironmentChecks
{
2013-10-22 20:09:21 +01:00
2013-11-10 13:57:35 -08:00
private EnvironmentChecks()
{
} // Singleton
2013-10-22 20:09:21 +01:00
/**
* 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.
2013-10-22 20:09:21 +01:00
*/
2013-11-10 13:57:35 -08:00
public static void verifyEnvironmentSanity ()
{
2013-10-30 22:15:03 +00:00
List<String> modIds = new ArrayList<String>();
2013-11-10 13:57:35 -08:00
if (Loader.isModLoaded("gregtech_addon"))
{
2013-11-17 11:35:59 +00:00
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.)");
2013-10-22 20:09:21 +01:00
modIds.add("gregtech_addon");
2013-10-30 22:15:03 +00:00
}
2013-10-22 20:09:21 +01:00
2013-11-17 11:35:59 +00:00
if (FMLCommonHandler.instance().getSide() == Side.CLIENT && FMLClientHandler.instance().hasOptifine() || Loader.isModLoaded("optifine"))
2013-11-10 13:57:35 -08:00
{
2013-10-30 22:15:03 +00:00
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!");
modIds.add("optifine");
}
2013-11-10 13:57:35 -08:00
try
{
2013-11-09 13:36:44 +00:00
Class cl = Class.forName("org.bukkit.Bukkit");
2013-11-10 13:57:35 -08:00
if (cl != null)
{
2013-11-09 13:36:44 +00:00
TConstruct.logger.severe("[Environment Checks] Bukkit implementation detected. This may be crashy. Bukkit implementations include Craftbukkit and MCPC+.");
modIds.add("bukkit");
}
2013-11-10 13:57:35 -08:00
}
catch (Exception ex)
{
2013-11-09 13:36:44 +00:00
// No Bukkit in environment.
}
2013-11-30 19:50:18 +00:00
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.
}
2013-11-10 13:57:35 -08:00
if (modIds.size() == 0)
{
ICrashCallable callable = new CallableSuppConfig();
FMLCommonHandler.instance().registerCrashCallable(callable);
2013-11-10 13:57:35 -08:00
}
else
{
2013-10-30 22:15:03 +00:00
ICrashCallable callable = new CallableUnsuppConfig(modIds);
FMLCommonHandler.instance().registerCrashCallable(callable);
2013-10-22 20:09:21 +01:00
}
}
}