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 ;
2013-10-22 20:09:21 +01:00
import java.util.ArrayList ;
import java.util.List ;
2013-12-05 00:29:59 -05:00
import tconstruct.TConstruct ;
2013-12-06 16:18:07 +00:00
import mantle.crash.CallableSuppConfig ;
import mantle.crash.CallableUnsuppConfig ;
2013-12-05 00:29:59 -05:00
2013-11-10 13:57:35 -08:00
public class EnvironmentChecks
{
2013-10-22 20:09:21 +01:00
2013-12-01 13:49:48 +00:00
// Used for aborting cloak renders with Optifine present (it misbehaves)
public static boolean hasOptifine = false ;
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.
2013-11-23 09:31:19 -05:00
* 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-10-24 12:27:50 +01:00
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-12-06 16:18:07 +00:00
// We keep this despite Mantle reporting it because we explicitly need Optifine marking for cloaks.
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-12-06 16:18:07 +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! Capes have been disabled." );
//modIds.add("optifine");
2013-12-01 13:49:48 +00:00
hasOptifine = true ;
2013-10-24 12:27:50 +01:00
}
2013-12-06 16:18:07 +00:00
// Bukkit/Magic Launcher are caught by Mantle, so we no longer check for those.
2013-11-30 19:50:18 +00:00
2013-11-10 13:57:35 -08:00
if ( modIds . size () == 0 )
{
2013-12-06 16:18:07 +00:00
ICrashCallable callable = new CallableSuppConfig ( "TConstruct" );
2013-10-24 12:27:50 +01:00
FMLCommonHandler . instance (). registerCrashCallable ( callable );
2013-11-10 13:57:35 -08:00
}
else
{
2013-12-06 16:18:07 +00:00
ICrashCallable callable = new CallableUnsuppConfig ( "TConstruct" , modIds );
2013-10-30 22:15:03 +00:00
FMLCommonHandler . instance (). registerCrashCallable ( callable );
2013-10-22 20:09:21 +01:00
}
}
}