2013-10-22 20:09:21 +01:00
package tconstruct.util ;
2014-09-09 18:30:15 +10:00
import cpw.mods.fml.common.* ;
import cpw.mods.fml.relauncher.Side ;
import java.util.* ;
import mantle.crash.* ;
2013-12-19 08:16:57 -08:00
import net.minecraftforge.common.MinecraftForge ;
import tconstruct.TConstruct ;
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-11-10 13:57:35 -08:00
private EnvironmentChecks ()
{
} // Singleton
2013-10-22 20:09:21 +01:00
/**
2014-02-16 14:23:50 -05: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-12-19 08:16:57 -08:00
private static List < String > incompatibilities = new ArrayList < String > ();
private static EnvironmentChecks instance = new EnvironmentChecks ();
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
2014-06-06 21:13:53 -04:00
if ( Loader . isModLoaded ( "gregtech" ))
2013-11-10 13:57:35 -08:00
{
2014-01-08 00:45:09 -05:00
TConstruct . logger . error ( "Tinkers' Construct and GregTech are incompatible for the following reasons:" );
TConstruct . logger . error ( modCompatDetails ( "GregTech" , true ));
2014-06-06 21:13:53 -04:00
modIds . add ( "gregtech" );
2013-12-19 08:16:57 -08:00
incompatibilities . add ( "GregTech" );
2013-10-30 22:15:03 +00:00
}
2013-10-22 20:09:21 +01:00
2014-02-16 14:23:50 -05:00
// Bukkit/Magic Launcher/Optifine 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
}
2013-12-19 08:16:57 -08:00
if ( incompatibilities . size () > 0 && FMLCommonHandler . instance (). getEffectiveSide () == Side . CLIENT )
{
MinecraftForge . EVENT_BUS . register ( instance );
}
2013-10-22 20:09:21 +01:00
}
2013-12-19 08:16:57 -08:00
public static String modCompatDetails ( String type , boolean consoleFormat )
{
String n = consoleFormat ? System . getProperty ( "line.separator" ) : "\n" ;
if ( type . equals ( "GregTech" ))
{
2014-09-09 18:30:15 +10:00
return "- GregTech is a meta-mod that changes how a lot of mods interact with the base game and with each other." + n + "- The mod restructures the registration of various ores within the Ore Dictionary. This may alter or break the original design intention of various other mods." + n + "- This mod alters various fundamental recipes from vanilla Minecraft." ;
2013-12-19 08:16:57 -08:00
}
return "" ;
}
2013-10-22 20:09:21 +01:00
}