diff options
Diffstat (limited to 'src/Java/gtPlusPlus/api/objects')
-rw-r--r-- | src/Java/gtPlusPlus/api/objects/CSPRNG.java | 8 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/api/objects/Logger.java | 131 |
2 files changed, 135 insertions, 4 deletions
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); + } + + + + +} |