Mods can add mod specific crash information to the crash report now
Forge needs to implement MinecraftForge.getCrashCallable
This commit is contained in:
parent
a17396eca5
commit
63e8249040
|
@ -20,6 +20,7 @@ import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.src.CrashReport;
|
||||||
import net.minecraft.src.DedicatedServer;
|
import net.minecraft.src.DedicatedServer;
|
||||||
import net.minecraft.src.Entity;
|
import net.minecraft.src.Entity;
|
||||||
import net.minecraft.src.EntityPlayer;
|
import net.minecraft.src.EntityPlayer;
|
||||||
|
@ -64,12 +65,18 @@ public class FMLCommonHandler
|
||||||
|
|
||||||
private List<IScheduledTickHandler> scheduledClientTicks = Lists.newArrayList();
|
private List<IScheduledTickHandler> scheduledClientTicks = Lists.newArrayList();
|
||||||
private List<IScheduledTickHandler> scheduledServerTicks = Lists.newArrayList();
|
private List<IScheduledTickHandler> scheduledServerTicks = Lists.newArrayList();
|
||||||
|
private Class<?> forge;
|
||||||
|
private boolean noForge;
|
||||||
|
private List<String> brandings;
|
||||||
|
private List<ICrashCallable> crashCallables = Lists.newArrayList(Loader.instance().getCallableCrashInformation());
|
||||||
|
|
||||||
|
|
||||||
public void beginLoading(IFMLSidedHandler handler)
|
public void beginLoading(IFMLSidedHandler handler)
|
||||||
{
|
{
|
||||||
sidedDelegate = handler;
|
sidedDelegate = handler;
|
||||||
FMLLog.info("Attempting early MinecraftForge initialization");
|
FMLLog.info("Attempting early MinecraftForge initialization");
|
||||||
callForgeMethod("initialize");
|
callForgeMethod("initialize");
|
||||||
|
callForgeMethod("registerCrashCallable");
|
||||||
FMLLog.info("Completed early MinecraftForge initialization");
|
FMLLog.info("Completed early MinecraftForge initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,9 +179,6 @@ public class FMLCommonHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Class<?> forge;
|
|
||||||
private boolean noForge;
|
|
||||||
private List<String> brandings;
|
|
||||||
private Class<?> findMinecraftForge()
|
private Class<?> findMinecraftForge()
|
||||||
{
|
{
|
||||||
if (forge==null && !noForge)
|
if (forge==null && !noForge)
|
||||||
|
@ -363,4 +367,17 @@ public class FMLCommonHandler
|
||||||
Side side = player instanceof EntityPlayerMP ? Side.SERVER : Side.CLIENT;
|
Side side = player instanceof EntityPlayerMP ? Side.SERVER : Side.CLIENT;
|
||||||
tickEnd(EnumSet.of(TickType.PLAYER), side, player);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package cpw.mods.fml.common;
|
||||||
|
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
public interface ICrashCallable extends Callable<String>
|
||||||
|
{
|
||||||
|
String getLabel();
|
||||||
|
}
|
|
@ -595,14 +595,20 @@ public class Loader
|
||||||
FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size()==1 ? "" : "s");
|
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<String>() {
|
return new ICrashCallable() {
|
||||||
@Override
|
@Override
|
||||||
public String call() throws Exception
|
public String call() throws Exception
|
||||||
{
|
{
|
||||||
return getCrashInformation();
|
return getCrashInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLabel()
|
||||||
|
{
|
||||||
|
return "FML";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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_)
|
Loading…
Reference in New Issue