diff --git a/common/cpw/mods/fml/common/FMLCommonHandler.java b/common/cpw/mods/fml/common/FMLCommonHandler.java index eb26bafc66..5b9e73ede7 100644 --- a/common/cpw/mods/fml/common/FMLCommonHandler.java +++ b/common/cpw/mods/fml/common/FMLCommonHandler.java @@ -20,6 +20,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import net.minecraft.server.MinecraftServer; +import net.minecraft.src.CrashReport; import net.minecraft.src.DedicatedServer; import net.minecraft.src.Entity; import net.minecraft.src.EntityPlayer; @@ -64,12 +65,18 @@ public class FMLCommonHandler private List scheduledClientTicks = Lists.newArrayList(); private List scheduledServerTicks = Lists.newArrayList(); + private Class forge; + private boolean noForge; + private List brandings; + private List crashCallables = Lists.newArrayList(Loader.instance().getCallableCrashInformation()); + public void beginLoading(IFMLSidedHandler handler) { sidedDelegate = handler; FMLLog.info("Attempting early MinecraftForge initialization"); callForgeMethod("initialize"); + callForgeMethod("registerCrashCallable"); FMLLog.info("Completed early MinecraftForge initialization"); } @@ -172,9 +179,6 @@ public class FMLCommonHandler } - private Class forge; - private boolean noForge; - private List brandings; private Class findMinecraftForge() { if (forge==null && !noForge) @@ -363,4 +367,17 @@ public class FMLCommonHandler Side side = player instanceof EntityPlayerMP ? Side.SERVER : Side.CLIENT; tickEnd(EnumSet.of(TickType.PLAYER), side, player); } + + public void registerCrashCallable(ICrashCallable callable) + { + crashCallables.add(callable); + } + + public void enhanceCrashReport(CrashReport crashReport) + { + for (ICrashCallable call: crashCallables) + { + crashReport.func_71500_a(call.getLabel(), call); + } + } } diff --git a/common/cpw/mods/fml/common/ICrashCallable.java b/common/cpw/mods/fml/common/ICrashCallable.java new file mode 100644 index 0000000000..ecd0586e68 --- /dev/null +++ b/common/cpw/mods/fml/common/ICrashCallable.java @@ -0,0 +1,8 @@ +package cpw.mods.fml.common; + +import java.util.concurrent.Callable; + +public interface ICrashCallable extends Callable +{ + String getLabel(); +} diff --git a/common/cpw/mods/fml/common/Loader.java b/common/cpw/mods/fml/common/Loader.java index ccb4d082cc..475d14f4f8 100644 --- a/common/cpw/mods/fml/common/Loader.java +++ b/common/cpw/mods/fml/common/Loader.java @@ -595,14 +595,20 @@ public class Loader FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size()==1 ? "" : "s"); } - public Callable getCallableCrashInformation() + public ICrashCallable getCallableCrashInformation() { - return new Callable() { + return new ICrashCallable() { @Override public String call() throws Exception { return getCrashInformation(); } + + @Override + public String getLabel() + { + return "FML"; + } }; } diff --git a/patches/common/net/minecraft/src/CrashReport.java.patch b/patches/common/net/minecraft/src/CrashReport.java.patch new file mode 100644 index 0000000000..341cfbb126 --- /dev/null +++ b/patches/common/net/minecraft/src/CrashReport.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/common/net/minecraft/src/CrashReport.java ++++ ../src-work/common/net/minecraft/src/CrashReport.java +@@ -1,5 +1,6 @@ + package net.minecraft.src; + ++import cpw.mods.fml.common.FMLCommonHandler; + import cpw.mods.fml.common.Side; + import cpw.mods.fml.common.asm.SideOnly; + import java.io.File; +@@ -39,6 +40,7 @@ + this.func_71500_a("Java VM Version", new CallableJavaInfo2(this)); + this.func_71500_a("Memory", new CallableMemoryInfo(this)); + this.func_71500_a("JVM Flags", new CallableJVMFlags(this)); ++ FMLCommonHandler.instance().enhanceCrashReport(this); + } + + public void func_71500_a(String p_71500_1_, Callable p_71500_2_)