Add Layout to CrashReport when drawing GUI

This commit is contained in:
johni0702
2015-07-11 15:12:33 +02:00
parent d8a9b8fd2f
commit 117f383ec0

View File

@@ -146,6 +146,12 @@ public abstract class AbstractGuiContainer<T extends AbstractGuiContainer<T>>
});
category.addCrashSection("Width", size.getWidth());
category.addCrashSection("Height", size.getHeight());
category.addCrashSectionCallable("Layout", new Callable() {
@Override
public Object call() throws Exception {
return layout;
}
});
category = crashReport.makeCategory("Gui element details");
category.addCrashSectionCallable("Element", new Callable() {
@Override
@@ -165,6 +171,14 @@ public abstract class AbstractGuiContainer<T extends AbstractGuiContainer<T>>
return eSize;
}
});
if (e.getKey() instanceof GuiContainer) {
category.addCrashSectionCallable("Layout", new Callable() {
@Override
public Object call() throws Exception {
return ((GuiContainer) e.getKey()).getLayout();
}
});
}
throw new ReportedException(crashReport);
}
}