Improve handling of CrashException in runLater (fixes #205)

This commit is contained in:
Jonas Herzig
2020-06-28 20:41:09 +02:00
parent a6f5931e7e
commit 0ab1db9517

View File

@@ -28,6 +28,7 @@ import net.minecraft.text.Style;
import net.minecraft.text.LiteralText; import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.crash.CrashException;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
//#if MC>=11400 //#if MC>=11400
@@ -539,6 +540,10 @@ public class ReplayMod implements
inRunLater = true; inRunLater = true;
try { try {
runnable.run(); runnable.run();
} catch (CrashException e) {
e.printStackTrace();
System.err.println(e.getReport().asString());
mc.setCrashReport(e.getReport());
} finally { } finally {
inRunLater = false; inRunLater = false;
} }
@@ -573,6 +578,10 @@ public class ReplayMod implements
//$$ inRunLater = true; //$$ inRunLater = true;
//$$ try { //$$ try {
//$$ runnable.run(); //$$ runnable.run();
//$$ } catch (ReportedException e) {
//$$ e.printStackTrace();
//$$ System.err.println(e.getCrashReport().getCompleteReport());
//$$ mc.crashed(e.getCrashReport());
//$$ } finally { //$$ } finally {
//$$ inRunLater = false; //$$ inRunLater = false;
//$$ } //$$ }