From da95d1f801d83b11479511b01d9d83bc822dfa2b Mon Sep 17 00:00:00 2001 From: vfyjxf Date: Wed, 14 Jul 2021 23:14:17 +0800 Subject: [PATCH] update --- .../mixins/MixinCrashReport.java | 6 ++++ .../mixins/client/MixinMinecraft.java | 32 ++++++++++++++++--- .../bettercrashes/utils/CrashUtils.java | 22 ++++++++++++- .../bettercrashes/utils/GuiCrashScreen.java | 7 ++++ .../utils/GuiInitErrorScreen.java | 7 ++++ .../bettercrashes/utils/GuiProblemScreen.java | 7 ++++ .../utils/IPatchedCrashReport.java | 9 ++++++ .../bettercrashes/utils/ModIdentifier.java | 9 ++++++ .../utils/StacktraceDeobfuscator.java | 9 ++++++ .../bettercrashes/utils/StateManager.java | 9 ++++++ 10 files changed, 112 insertions(+), 5 deletions(-) diff --git a/src/main/java/vfyjxf/bettercrashes/mixins/MixinCrashReport.java b/src/main/java/vfyjxf/bettercrashes/mixins/MixinCrashReport.java index 4b366c2..733c1d9 100644 --- a/src/main/java/vfyjxf/bettercrashes/mixins/MixinCrashReport.java +++ b/src/main/java/vfyjxf/bettercrashes/mixins/MixinCrashReport.java @@ -1,3 +1,9 @@ +/* + *This file is from + *https://github.com/DimensionalDevelopment/VanillaFix/blob/master/src/main/java/org/dimdev/vanillafix/crashes/mixins/MixinCrashReport.java + *The source file uses the MIT License. + */ + package vfyjxf.bettercrashes.mixins; import cpw.mods.fml.common.ModContainer; diff --git a/src/main/java/vfyjxf/bettercrashes/mixins/client/MixinMinecraft.java b/src/main/java/vfyjxf/bettercrashes/mixins/client/MixinMinecraft.java index 185215f..182805a 100644 --- a/src/main/java/vfyjxf/bettercrashes/mixins/client/MixinMinecraft.java +++ b/src/main/java/vfyjxf/bettercrashes/mixins/client/MixinMinecraft.java @@ -1,5 +1,10 @@ -package vfyjxf.bettercrashes.mixins.client; +/* + *This file is modified based on + *https://github.com/DimensionalDevelopment/VanillaFix/blob/master/src/main/java/org/dimdev/vanillafix/crashes/mixins/client/MixinMinecraft.java + *The source file uses the MIT License. + */ +package vfyjxf.bettercrashes.mixins.client; import cpw.mods.fml.client.SplashProgress; import cpw.mods.fml.common.Loader; @@ -39,7 +44,9 @@ import java.io.IOException; import java.util.List; import java.util.Queue; - +/** + * @author Runemoro + */ @Mixin(Minecraft.class) public abstract class MixinMinecraft{ @@ -141,6 +148,10 @@ public abstract class MixinMinecraft{ } + /** + * @author Runemoro + * @param report + */ public void displayCrashScreen(CrashReport report) { try { CrashUtils.outputReport(report); @@ -170,6 +181,10 @@ public abstract class MixinMinecraft{ crashReport.getCategory().addCrashSectionCallable("Client Crashes Since Restart",() -> String.valueOf(clientCrashCount)); crashReport.getCategory().addCrashSectionCallable("Integrated Server Crashes Since Restart", () -> String.valueOf(serverCrashCount)); } + + /** + * @author Runemoro + */ public void resetGameState() { try { // Free up memory such that this works properly in case of an OutOfMemoryError @@ -205,6 +220,11 @@ public abstract class MixinMinecraft{ } catch (Throwable ignored) {} } } + + /** + * @author Runemoro + * @param report + */ public void displayInitErrorScreen(CrashReport report) { CrashUtils.outputReport(report); try { @@ -234,6 +254,11 @@ public abstract class MixinMinecraft{ System.exit(report.getFile() != null ? -1 : -2); } } + + /** + * @author Runemoro + * @param screen + */ private void runGUILoop(GuiScreen screen) throws IOException { displayGuiScreen(screen); while (running && currentScreen != null && !(currentScreen instanceof GuiMainMenu) && !(Loader.isModLoaded("custommainmenu"))) { @@ -283,10 +308,9 @@ public abstract class MixinMinecraft{ } - /** * @author Runemoro - * @reason + * @param report */ @Overwrite public void displayCrashReport(CrashReport report) { diff --git a/src/main/java/vfyjxf/bettercrashes/utils/CrashUtils.java b/src/main/java/vfyjxf/bettercrashes/utils/CrashUtils.java index 3454b66..637e691 100644 --- a/src/main/java/vfyjxf/bettercrashes/utils/CrashUtils.java +++ b/src/main/java/vfyjxf/bettercrashes/utils/CrashUtils.java @@ -1,3 +1,9 @@ +/* + *This file is modified based on + *https://github.com/DimensionalDevelopment/VanillaFix/blob/99cb47cc05b4790e8ef02bbcac932b21dafa107f/src/main/java/org/dimdev/vanillafix/crashes/CrashUtils.java + *The source file uses the MIT License. + */ + package vfyjxf.bettercrashes.utils; import net.minecraft.client.Minecraft; @@ -10,9 +16,15 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; +/** + * @author Runemoro + */ public class CrashUtils { - + /** + * @author Runemoro + * @param report + */ public static void outputReport(CrashReport report) { try { if (report.getFile() == null) { @@ -34,6 +46,9 @@ public class CrashUtils { + "\n" + report.getCompleteReport()); } + /** + * @author Runemoro + */ private static boolean isClient() { try { return Minecraft.getMinecraft() != null; @@ -42,6 +57,11 @@ public class CrashUtils { } } + /** + * @author vfyjxf + * @param crashReport + * @throws IOException + */ public static void openCrashReport(CrashReport crashReport) throws IOException { if(!Desktop.isDesktopSupported()){ diff --git a/src/main/java/vfyjxf/bettercrashes/utils/GuiCrashScreen.java b/src/main/java/vfyjxf/bettercrashes/utils/GuiCrashScreen.java index defc027..26ad2fd 100644 --- a/src/main/java/vfyjxf/bettercrashes/utils/GuiCrashScreen.java +++ b/src/main/java/vfyjxf/bettercrashes/utils/GuiCrashScreen.java @@ -1,3 +1,9 @@ +/* + *This file is modified based on + *https://github.com/DimensionalDevelopment/VanillaFix/blob/99cb47cc05b4790e8ef02bbcac932b21dafa107f/src/main/java/org/dimdev/vanillafix/crashes/GuiCrashScreen.java + *The source file uses the MIT License. + */ + package vfyjxf.bettercrashes.utils; import cpw.mods.fml.relauncher.Side; @@ -8,6 +14,7 @@ import net.minecraft.client.gui.GuiOptionButton; import net.minecraft.client.resources.I18n; import net.minecraft.crash.CrashReport; + @SideOnly(Side.CLIENT) public class GuiCrashScreen extends GuiProblemScreen{ public GuiCrashScreen(CrashReport report) { diff --git a/src/main/java/vfyjxf/bettercrashes/utils/GuiInitErrorScreen.java b/src/main/java/vfyjxf/bettercrashes/utils/GuiInitErrorScreen.java index 3d5ea4d..c788fc7 100644 --- a/src/main/java/vfyjxf/bettercrashes/utils/GuiInitErrorScreen.java +++ b/src/main/java/vfyjxf/bettercrashes/utils/GuiInitErrorScreen.java @@ -1,3 +1,10 @@ +/* + *This file is modified based on + *https://github.com/DimensionalDevelopment/VanillaFix/blob/99cb47cc05b4790e8ef02bbcac932b21dafa107f/src/main/java/org/dimdev/vanillafix/crashes/GuiInitErrorScreen.java + *The source file uses the MIT License. + */ + + package vfyjxf.bettercrashes.utils; import cpw.mods.fml.relauncher.Side; diff --git a/src/main/java/vfyjxf/bettercrashes/utils/GuiProblemScreen.java b/src/main/java/vfyjxf/bettercrashes/utils/GuiProblemScreen.java index 7515c25..bae2d53 100644 --- a/src/main/java/vfyjxf/bettercrashes/utils/GuiProblemScreen.java +++ b/src/main/java/vfyjxf/bettercrashes/utils/GuiProblemScreen.java @@ -1,3 +1,9 @@ +/* + *This file is modified based on + *https://github.com/DimensionalDevelopment/VanillaFix/blob/99cb47cc05b4790e8ef02bbcac932b21dafa107f/src/main/java/org/dimdev/vanillafix/crashes/GuiProblemScreen.java + *The source file uses the MIT License. + */ + package vfyjxf.bettercrashes.utils; import cpw.mods.fml.common.ModContainer; @@ -15,6 +21,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; + @SideOnly(Side.CLIENT) public abstract class GuiProblemScreen extends GuiScreen { diff --git a/src/main/java/vfyjxf/bettercrashes/utils/IPatchedCrashReport.java b/src/main/java/vfyjxf/bettercrashes/utils/IPatchedCrashReport.java index d0d6501..58680ae 100644 --- a/src/main/java/vfyjxf/bettercrashes/utils/IPatchedCrashReport.java +++ b/src/main/java/vfyjxf/bettercrashes/utils/IPatchedCrashReport.java @@ -1,9 +1,18 @@ +/* + *This file is from + *https://github.com/DimensionalDevelopment/VanillaFix/blob/99cb47cc05b4790e8ef02bbcac932b21dafa107f/src/main/java/org/dimdev/vanillafix/crashes/IPatchedCrashReport.java + *The source file uses the MIT License. + */ + package vfyjxf.bettercrashes.utils; import cpw.mods.fml.common.ModContainer; import java.util.Set; +/** + * @author Runemoro + */ public interface IPatchedCrashReport { Set getSuspectedMods(); } diff --git a/src/main/java/vfyjxf/bettercrashes/utils/ModIdentifier.java b/src/main/java/vfyjxf/bettercrashes/utils/ModIdentifier.java index 0282f68..40c986f 100644 --- a/src/main/java/vfyjxf/bettercrashes/utils/ModIdentifier.java +++ b/src/main/java/vfyjxf/bettercrashes/utils/ModIdentifier.java @@ -1,3 +1,9 @@ +/* + *This file is from + *https://github.com/DimensionalDevelopment/VanillaFix/blob/master/src/main/java/org/dimdev/utils/ModIdentifier.java + *The source file uses the MIT License. + */ + package vfyjxf.bettercrashes.utils; import cpw.mods.fml.common.Loader; @@ -14,6 +20,9 @@ import java.net.URISyntaxException; import java.net.URL; import java.util.*; +/** + * @author Runemoro + */ public final class ModIdentifier { private static final Logger log = LogManager.getLogger(); diff --git a/src/main/java/vfyjxf/bettercrashes/utils/StacktraceDeobfuscator.java b/src/main/java/vfyjxf/bettercrashes/utils/StacktraceDeobfuscator.java index 12712c0..61d8800 100644 --- a/src/main/java/vfyjxf/bettercrashes/utils/StacktraceDeobfuscator.java +++ b/src/main/java/vfyjxf/bettercrashes/utils/StacktraceDeobfuscator.java @@ -1,3 +1,9 @@ +/* + *This file is from + *https://github.com/DimensionalDevelopment/VanillaFix/blob/master/src/main/java/org/dimdev/vanillafix/crashes/StacktraceDeobfuscator.java + *The source file uses the MIT License. + */ + package vfyjxf.bettercrashes.utils; import java.io.File; @@ -10,6 +16,9 @@ import java.util.*; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +/** + * @author Runemoro + */ public final class StacktraceDeobfuscator { private static final boolean DEBUG_IN_DEV = false; // Makes this MCP -> SRG for testing in dev. Don't forget to set to false when done! private static HashMap srgMcpMethodMap = null; diff --git a/src/main/java/vfyjxf/bettercrashes/utils/StateManager.java b/src/main/java/vfyjxf/bettercrashes/utils/StateManager.java index 5cc1f93..ab22c1a 100644 --- a/src/main/java/vfyjxf/bettercrashes/utils/StateManager.java +++ b/src/main/java/vfyjxf/bettercrashes/utils/StateManager.java @@ -1,3 +1,9 @@ +/* + *This file is from + *https://github.com/DimensionalDevelopment/VanillaFix/blob/master/src/main/java/org/dimdev/vanillafix/crashes/StateManager.java + *The source file uses the MIT License. + */ + package vfyjxf.bettercrashes.utils; import java.lang.ref.WeakReference; @@ -5,6 +11,9 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; +/** + * @author Runemoro + */ public class StateManager { public interface IResettable { default void register() {