From 5715a32d2901922503fd850f3a68503fb77467c3 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Wed, 20 Dec 2017 23:39:49 +1000 Subject: - Disabled some logging. % Minor Project Clean-up, added missing Override annotations to 100+ methods & removed pointless casts. % Moved Logging to it's own class. $ Fixed Multi-block handling of Pollution. $ Fixed the GT 5.09 material enabler system. (From My Side, it's still borked on GTs). + Added a Dynamic Proxy invocation for IMaterialHandler. + Added an AutoMap data type, which is a Auto-incremental ID'd Hashmap wrapper. --- src/Java/gtPlusPlus/api/objects/CSPRNG.java | 8 +- src/Java/gtPlusPlus/api/objects/Logger.java | 131 ++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 src/Java/gtPlusPlus/api/objects/Logger.java (limited to 'src/Java/gtPlusPlus/api/objects') diff --git a/src/Java/gtPlusPlus/api/objects/CSPRNG.java b/src/Java/gtPlusPlus/api/objects/CSPRNG.java index 6b78eaccfc..e55a650b67 100644 --- a/src/Java/gtPlusPlus/api/objects/CSPRNG.java +++ b/src/Java/gtPlusPlus/api/objects/CSPRNG.java @@ -34,14 +34,13 @@ */ package gtPlusPlus.api.objects; +import java.math.BigInteger; +import java.security.SecureRandom; import java.util.Random; import gtPlusPlus.api.interfaces.IRandomGenerator; import gtPlusPlus.core.util.Utils; -import java.security.SecureRandom; -import java.math.BigInteger; - /** * The Blum-Blum-Shub random number generator. * @@ -205,7 +204,8 @@ public class CSPRNG extends Random implements IRandomGenerator { * * @return int */ - public int next(int numBits) { + @Override + public int next(int numBits) { // TODO: find out how many LSB one can extract per cycle. // it is more than one. int result = 0; diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java new file mode 100644 index 0000000000..44657d337a --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/Logger.java @@ -0,0 +1,131 @@ +package gtPlusPlus.api.objects; + +import org.apache.logging.log4j.LogManager; + +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.proxy.ClientProxy; + +public class Logger { + + // Logging Functions + public static final org.apache.logging.log4j.Logger modLogger = Logger.makeLogger(); + + // Generate GT++ Logger + public static org.apache.logging.log4j.Logger makeLogger() { + final org.apache.logging.log4j.Logger gtPlusPlusLogger = LogManager.getLogger("GT++"); + return gtPlusPlusLogger; + } + + public static final org.apache.logging.log4j.Logger getLogger(){ + return modLogger; + } + + // Non-Dev Comments + public static void INFO(final String s) { + modLogger.info(s); + } + + // Non-Dev Comments + public static void MACHINE_INFO(final String s) { + + boolean localPlayer = false; + try { + if (ClientProxy.playerName != null){ + if (ClientProxy.playerName.toLowerCase().contains("draknyte1")){ + localPlayer = true; + } + } + } + catch (final Throwable t){ + + } + + if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) { + final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2); + modLogger.info("Machine Info: " + s + " | " + name1); + } + } + + // Developer Comments + public static void WARNING(final String s) { + if (CORE.DEBUG) { + modLogger.warn(s); + } + } + + // Errors + public static void ERROR(final String s) { + if (CORE.DEBUG) { + modLogger.fatal(s); + } + } + + // Developer Logger + public static void SPECIFIC_WARNING(final String whatToLog, final String msg, final int line) { + // if (!CORE.DEBUG){ + FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg); + // } + } + + // ASM Comments + public static void LOG_ASM(final String s) { + FMLRelaunchLog.info("", s); + } + + + + + + + + + + + /** + * Special Loggers + */ + + /** + * Special Logger for Bee related content + */ + public static void BEES(final String s) { + modLogger.info("[Bees] "+s); + } + /** + * Special Logger for Debugging Bee related content + */ + public static void DEBUG_BEES(final String s) { + if (CORE.DEVENV || CORE.DEBUG) + modLogger.info("[Debug][Bees] "+s); + } + + + + /** + * Special Logger for Materials related content + */ + public static void MATERIALS(final String s) { + modLogger.info("[Materials] "+s); + } + /** + * Special Logger for Debugging Materials related content + */ + public static void DEBUG_MATERIALS(final String s) { + if (CORE.DEVENV || CORE.DEBUG) + modLogger.info("[Debug][Materials] "+s); + } + + /** + * Special Logger for Bee related content + */ + public static void REFLECTION(final String s) { + if (CORE.DEVENV || CORE.DEBUG) + modLogger.info("[Reflection] "+s); + } + + + + +} -- cgit