Move EnvChecks into lib.environment, make hasOptifine flag, make unsupp logging configurable.

This commit is contained in:
Sunstrike committed 2013-12-06 16:53:05 +00:00
1 parent 02b5126e54
commit 425894733a
3 files changed
+14 -6

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ import cpw.mods.fml.common.Mod.EventHandler;
import net.minecraftforge.common.Configuration;
import static mantle.lib.CoreRepo.*;
import mantle.lib.CoreConfig;
import mantle.internal.EnvironmentChecks;
import mantle.lib.environment.EnvironmentChecks;
/**
* Mantle
+4 -1
View File
@@ -23,10 +23,13 @@ public class CoreConfig
logger.info("Loading configuration from disk.");
config.load();
// TODO: Config vars get/set here
silenceEnvChecks = config.get("Environment", "unsupportedLogging", silenceEnvChecks).getBoolean(silenceEnvChecks);
config.save();
logger.info("Configuration load completed.");
}
// BEGIN CONFIG VARS
public static boolean silenceEnvChecks = false;
}
@@ -1,4 +1,4 @@
package mantle.internal;
package mantle.lib.environment;
import java.util.ArrayList;
import java.util.List;
@@ -10,6 +10,7 @@ import cpw.mods.fml.common.ICrashCallable;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import mantle.crash.*;
import mantle.lib.CoreConfig;
/**
* Environment Checks
@@ -25,6 +26,9 @@ public class EnvironmentChecks
{
} // Singleton
// Usable by other mods to detect Optifine.
public static boolean hasOptifine = false;
/**
* 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.
@@ -35,7 +39,8 @@ public class EnvironmentChecks
if (FMLCommonHandler.instance().getSide() == Side.CLIENT && FMLClientHandler.instance().hasOptifine() || Loader.isModLoaded("optifine"))
{
logger.severe("[Environment Checks] Optifine detected. This may cause issues due to base edits or ASM usage.");
if (!CoreConfig.silenceEnvChecks) logger.severe("[Environment Checks] Optifine detected. This may cause issues due to base edits or ASM usage.");
hasOptifine = true;
modIds.add("optifine");
}
@@ -44,7 +49,7 @@ public class EnvironmentChecks
Class cl = Class.forName("org.bukkit.Bukkit");
if (cl != null)
{
logger.severe("[Environment Checks] Bukkit implementation detected. This may cause issues. Bukkit implementations include Craftbukkit and MCPC+.");
if (!CoreConfig.silenceEnvChecks) logger.severe("[Environment Checks] Bukkit implementation detected. This may cause issues. Bukkit implementations include Craftbukkit and MCPC+.");
modIds.add("bukkit");
}
}
@@ -58,7 +63,7 @@ public class EnvironmentChecks
Class cl = Class.forName("magic.launcher.Launcher");
if (cl != null)
{
logger.severe("[Environment Checks] Magic Launcher detected. This launches the game in strange ways and as such is not recommended.");
if (!CoreConfig.silenceEnvChecks) logger.severe("[Environment Checks] Magic Launcher detected. This launches the game in strange ways and as such is not recommended.");
modIds.add("magic_launcher");
}
}