aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2022-01-09 17:49:52 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2022-01-09 17:49:52 +0000
commit13b79706b6eddef6118453bf51782ad01b3e8328 (patch)
tree28afa10d207b77e5e127c21ad71dbe8b698c8a84 /src/main/java/gtPlusPlus/core
parent77fb0cac1c9c2b57262f41da64926fe2778a3b65 (diff)
downloadGT5-Unofficial-13b79706b6eddef6118453bf51782ad01b3e8328.tar.gz
GT5-Unofficial-13b79706b6eddef6118453bf51782ad01b3e8328.tar.bz2
GT5-Unofficial-13b79706b6eddef6118453bf51782ad01b3e8328.zip
Partially implemented Computer Cube.
Fix Multis wanting Mufflers when pollution = 0. Fix getMethodName potentially crawling too far up the stack.
Diffstat (limited to 'src/main/java/gtPlusPlus/core')
-rw-r--r--src/main/java/gtPlusPlus/core/lib/CORE.java49
-rw-r--r--src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java3
2 files changed, 30 insertions, 22 deletions
diff --git a/src/main/java/gtPlusPlus/core/lib/CORE.java b/src/main/java/gtPlusPlus/core/lib/CORE.java
index d805375e2d..bb0df9d5fb 100644
--- a/src/main/java/gtPlusPlus/core/lib/CORE.java
+++ b/src/main/java/gtPlusPlus/core/lib/CORE.java
@@ -333,28 +333,33 @@ public class CORE {
}
public static final void crash(String aReason) {
- Logger.INFO("==========================================================");
- Logger.INFO("[GT++ CRASH]");
- Logger.INFO("==========================================================");
- Logger.INFO("Oooops...");
- Logger.INFO("This should only happy in a development environment or when something really bad happens.");
- Logger.INFO("Reason: "+aReason);
- Logger.INFO("==========================================================");
- Logger.INFO("Called from: "+ReflectionUtils.getMethodName(1));
- Logger.INFO(ReflectionUtils.getMethodName(2));
- Logger.INFO(ReflectionUtils.getMethodName(3));
- Logger.INFO(ReflectionUtils.getMethodName(4));
- Logger.INFO(ReflectionUtils.getMethodName(5));
- Logger.INFO(ReflectionUtils.getMethodName(6));
- Logger.INFO(ReflectionUtils.getMethodName(7));
- Logger.INFO(ReflectionUtils.getMethodName(8));
- Logger.INFO(ReflectionUtils.getMethodName(9));
- Logger.INFO(ReflectionUtils.getMethodName(10));
- Logger.INFO(ReflectionUtils.getMethodName(11));
- Logger.INFO(ReflectionUtils.getMethodName(12));
- Logger.INFO(ReflectionUtils.getMethodName(13));
- Logger.INFO(ReflectionUtils.getMethodName(14));
- Logger.INFO(ReflectionUtils.getMethodName(15));
+ try {
+ Logger.INFO("==========================================================");
+ Logger.INFO("[GT++ CRASH]");
+ Logger.INFO("==========================================================");
+ Logger.INFO("Oooops...");
+ Logger.INFO("This should only happy in a development environment or when something really bad happens.");
+ Logger.INFO("Reason: "+aReason);
+ Logger.INFO("==========================================================");
+ Logger.INFO("Called from: "+ReflectionUtils.getMethodName(1));
+ Logger.INFO(ReflectionUtils.getMethodName(2));
+ Logger.INFO(ReflectionUtils.getMethodName(3));
+ Logger.INFO(ReflectionUtils.getMethodName(4));
+ Logger.INFO(ReflectionUtils.getMethodName(5));
+ Logger.INFO(ReflectionUtils.getMethodName(6));
+ Logger.INFO(ReflectionUtils.getMethodName(7));
+ Logger.INFO(ReflectionUtils.getMethodName(8));
+ Logger.INFO(ReflectionUtils.getMethodName(9));
+ Logger.INFO(ReflectionUtils.getMethodName(10));
+ Logger.INFO(ReflectionUtils.getMethodName(11));
+ Logger.INFO(ReflectionUtils.getMethodName(12));
+ Logger.INFO(ReflectionUtils.getMethodName(13));
+ Logger.INFO(ReflectionUtils.getMethodName(14));
+ Logger.INFO(ReflectionUtils.getMethodName(15));
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
FMLCommonHandler.instance().exitJava(0, true);
}
diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
index 1ef925f793..aaec2024e4 100644
--- a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
+++ b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
@@ -335,6 +335,9 @@ public class ReflectionUtils {
public static String getMethodName(final int depth) {
final StackTraceElement[] ste = new Throwable().getStackTrace();
//System. out.println(ste[ste.length-depth].getClassName()+"#"+ste[ste.length-depth].getMethodName());
+ if (ste.length < depth) {
+ return "No valid stack.";
+ }
return ste[depth+1].getMethodName();
}