diff --git a/README.md b/README.md index 269ea29..0ee562e 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,8 @@ BetterCrashes is a port of VanillaFix's crash improvement features to Minecraft 1.7.10. -BetterCrashes makes Minecraft return you to the main menu when it crashes,and offer to upload - -your CrashReport to [ubuntu Pastebin](http://paste.ubuntu.com/) (closed by default). +BetterCrashes makes Minecraft return you to the main menu when it crashes,and it can upload your Crash-Report to +[Ubuntu Pastebin](http://paste.ubuntu.com/) for send the link easier. Most of the code comes from VanillaFix, I just make them work on Minecraft 1.7.10. diff --git a/gradle.properties b/gradle.properties index 5418dd4..8946a5a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.daemon=false # General Specifications mc_version=1.7.10 -mod_version=1.1.0 +mod_version=1.1.1 forge_version=10.13.4.1614 mod_group=vfyjxf.bettercrashes mod_id=bettercrashes diff --git a/src/main/java/vfyjxf/bettercrashes/BetterCrashes.java b/src/main/java/vfyjxf/bettercrashes/BetterCrashes.java index 4fdd8cc..1e7e5f2 100644 --- a/src/main/java/vfyjxf/bettercrashes/BetterCrashes.java +++ b/src/main/java/vfyjxf/bettercrashes/BetterCrashes.java @@ -1,15 +1,10 @@ package vfyjxf.bettercrashes; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import net.minecraft.client.Minecraft; +import cpw.mods.fml.common.Mod; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import cpw.mods.fml.common.Mod; - -import java.io.File; - @Mod(modid = BetterCrashes.MODID, version = BetterCrashes.VERSION, name = BetterCrashes.NAME,dependencies = BetterCrashes.DEPENDENCIES) public class BetterCrashes { public static final String MODID = "bettercrashes"; @@ -18,8 +13,5 @@ public class BetterCrashes { public static final String DEPENDENCIES = "required-after:grimoire"; public static final Logger logger = LogManager.getLogger("BetterCrashes"); - @Mod.EventHandler - public void preInit(FMLPreInitializationEvent event){ - BetterCrashesConfig.loadConfig(new File(Minecraft.getMinecraft().mcDataDir,"config/BetterCrashes.cfg")); - } + } diff --git a/src/main/java/vfyjxf/bettercrashes/utils/GuiCrashScreen.java b/src/main/java/vfyjxf/bettercrashes/utils/GuiCrashScreen.java index 26ad2fd..61413d2 100644 --- a/src/main/java/vfyjxf/bettercrashes/utils/GuiCrashScreen.java +++ b/src/main/java/vfyjxf/bettercrashes/utils/GuiCrashScreen.java @@ -16,14 +16,15 @@ @SideOnly(Side.CLIENT) -public class GuiCrashScreen extends GuiProblemScreen{ +public class GuiCrashScreen extends GuiProblemScreen { public GuiCrashScreen(CrashReport report) { super(report); } + @Override public void initGui() { super.initGui(); - GuiOptionButton mainMenuButton = new GuiOptionButton(0, width / 2 - 155, height / 4 + 120 + 12, I18n.format("bettercrashes.gui.toTitle")); + GuiOptionButton mainMenuButton = new GuiOptionButton(0, width / 2 - 50 - 115, height / 4 + 120 + 12, 110, 20, I18n.format("bettercrashes.gui.toTitle")); buttonList.add(mainMenuButton); } @@ -56,7 +57,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { // TODO: lo drawString(fontRendererObj, I18n.format("bettercrashes.crashscreen.paragraph3.line1"), x, y += 12, textColor); drawString(fontRendererObj, I18n.format("bettercrashes.crashscreen.paragraph3.line2"), x, y += 9, textColor); drawString(fontRendererObj, I18n.format("bettercrashes.crashscreen.paragraph3.line3"), x, y += 9, textColor); - + drawString(fontRendererObj, I18n.format("bettercrashes.crashscreen.paragraph3.line4"), x, y += 9, textColor); super.drawScreen(mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/vfyjxf/bettercrashes/utils/GuiInitErrorScreen.java b/src/main/java/vfyjxf/bettercrashes/utils/GuiInitErrorScreen.java index c788fc7..224f9b9 100644 --- a/src/main/java/vfyjxf/bettercrashes/utils/GuiInitErrorScreen.java +++ b/src/main/java/vfyjxf/bettercrashes/utils/GuiInitErrorScreen.java @@ -24,7 +24,8 @@ public GuiInitErrorScreen(CrashReport report) { public void initGui() { mc.setIngameNotInFocus(); buttonList.clear(); - buttonList.add(new GuiButton(1, width / 2 - 155, height / 4 + 120 + 12, 310, 20, I18n.format("bettercrashes.gui.openCrashReport"))); + buttonList.add(new GuiButton(1,width / 2 - 155, height / 4 + 120 + 12, 150, 20, I18n.format("bettercrashes.gui.openCrashReport"))); + buttonList.add(new GuiButton(2, width / 2 - 155 + 160, height / 4 + 120 + 12, 150, 20, I18n.format("bettercrashes.gui.uploadReportAndCopyLink"))); } @Override @@ -53,7 +54,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) { // TODO: lo drawString(fontRendererObj, I18n.format("bettercrashes.initerrorscreen.paragraph3.line1"), x, y += 12, textColor); drawString(fontRendererObj, I18n.format("bettercrashes.initerrorscreen.paragraph3.line2"), x, y += 9, textColor); drawString(fontRendererObj, I18n.format("bettercrashes.initerrorscreen.paragraph3.line3"), x, y += 9, textColor); - + drawString(fontRendererObj, I18n.format("bettercrashes.initerrorscreen.paragraph3.line4"), x, y += 9, textColor); super.drawScreen(mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/vfyjxf/bettercrashes/utils/GuiProblemScreen.java b/src/main/java/vfyjxf/bettercrashes/utils/GuiProblemScreen.java index 23554cd..751693f 100644 --- a/src/main/java/vfyjxf/bettercrashes/utils/GuiProblemScreen.java +++ b/src/main/java/vfyjxf/bettercrashes/utils/GuiProblemScreen.java @@ -14,7 +14,6 @@ import net.minecraft.client.resources.I18n; import net.minecraft.crash.CrashReport; import org.apache.commons.lang3.StringUtils; -import vfyjxf.bettercrashes.BetterCrashesConfig; import java.io.IOException; import java.util.ArrayList; @@ -37,17 +36,22 @@ public GuiProblemScreen(CrashReport report) { public void initGui() { mc.setIngameNotInFocus(); buttonList.clear(); - if(BetterCrashesConfig.enableUploadCrash) { - buttonList.add(new GuiButton(1, width / 2 - 155 + 160, height / 4 + 120 + 12, 150, 20, I18n.format("bettercrashes.gui.uploadReportAndCopyLink"))); - }else { - buttonList.add(new GuiButton(1, width / 2 - 155 + 160, height / 4 + 120 + 12, 150, 20, I18n.format("bettercrashes.gui.openCrashReport"))); - } + buttonList.add(new GuiButton(1, width / 2 - 50, height / 4 + 120 + 12, 110, 20, I18n.format("bettercrashes.gui.openCrashReport"))); + buttonList.add(new GuiButton(2, width / 2 - 50 + 115, height / 4 + 120 + 12, 110, 20, I18n.format("bettercrashes.gui.uploadReportAndCopyLink"))); } - @Override protected void actionPerformed(GuiButton button) { - if(button.id == 1 && BetterCrashesConfig.enableUploadCrash){ + if (button.id == 1){ + try { + CrashUtils.openCrashReport(report); + } catch (IOException e) { + button.displayString = I18n.format("bettercrashes.gui.failed"); + button.enabled = false; + e.printStackTrace(); + } + } + if(button.id == 2){ if(hasteLink == null){ try { hasteLink = CrashReportUpload.uploadToUbuntuPastebin("https://paste.ubuntu.com",report.getCompleteReport()); @@ -58,15 +62,8 @@ protected void actionPerformed(GuiButton button) { } } setClipboardString(hasteLink); - }else if (button.id == 1){ - try { - CrashUtils.openCrashReport(report); - } catch (IOException e) { - button.displayString = I18n.format("bettercrashes.gui.failed"); - button.enabled = false; - e.printStackTrace(); - } } + } @Override diff --git a/src/main/resources/assets/bettercrashes/lang/en_US.lang b/src/main/resources/assets/bettercrashes/lang/en_US.lang index 1b59a28..e8be555 100644 --- a/src/main/resources/assets/bettercrashes/lang/en_US.lang +++ b/src/main/resources/assets/bettercrashes/lang/en_US.lang @@ -1,4 +1,4 @@ -bettercrashes.gui.uploadReportAndCopyLink=Copy Link +bettercrashes.gui.uploadReportAndCopyLink=Upload and copy link bettercrashes.gui.openCrashReport=Open Crash Report bettercrashes.gui.failed=[Failed] bettercrashes.crashscreen.identificationErrored=[Error identifying] @@ -9,14 +9,15 @@ bettercrashes.crashscreen.title=Minecraft crashed! bettercrashes.crashscreen.summary=Minecraft ran into a problem and crashed. bettercrashes.crashscreen.paragraph1.line1=The following mod(s) have been identified as potential causes: bettercrashes.crashscreen.paragraph2.line1=report has been generated, and click the button below to open: -bettercrashes.crashscreen.paragraph3.line1=You're encouraged to send this report to the mod's author to help -bettercrashes.crashscreen.paragraph3.line2=them fix the issue. Since Since BetterCrashes is installed, you can keep -bettercrashes.crashscreen.paragraph3.line3=playing despite the crash. +bettercrashes.crashscreen.paragraph3.line1=You're encouraged to send this report's link to the mod's author to help +bettercrashes.crashscreen.paragraph3.line2=them fix the issue, click the "Upload and Copy link" can upload report +bettercrashes.crashscreen.paragraph3.line3=and copy its link to clipboard. Since BetterCrashes is installed, you +bettercrashes.crashscreen.paragraph3.line4=can keep playing despite the crash. bettercrashes.initerrorscreen.title=Minecraft failed to start! bettercrashes.initerrorscreen.summary=An error during startup prevented Minecraft from starting. bettercrashes.initerrorscreen.paragraph2.line1=report has been generated, and click the button below to open: -bettercrashes.initerrorscreen.paragraph3.line1=You're encouraged to send this report to the mod's author to help -bettercrashes.initerrorscreen.paragraph3.line2=them fix the issue. Since BetterCrashes is installed, you can keep -bettercrashes.initerrorscreen.paragraph3.line3=playing despite the crash. - +bettercrashes.initerrorscreen.paragraph3.line1=You're encouraged to send this report's link to the mod's author to help +bettercrashes.initerrorscreen.paragraph3.line2=them fix the issue, click the "Upload and Copy link" can upload report +bettercrashes.initerrorscreen.paragraph3.line3=and copy its link to clipboard. Since BetterCrashes is installed, you +bettercrashes.initerrorscreen.paragraph3.line4=can keep playing despite the crash. diff --git a/src/main/resources/assets/bettercrashes/lang/zh_CN.lang b/src/main/resources/assets/bettercrashes/lang/zh_CN.lang index b2b7d03..07154aa 100644 --- a/src/main/resources/assets/bettercrashes/lang/zh_CN.lang +++ b/src/main/resources/assets/bettercrashes/lang/zh_CN.lang @@ -1,4 +1,4 @@ -bettercrashes.gui.uploadReportAndCopyLink=复制链接到剪贴板 +bettercrashes.gui.uploadReportAndCopyLink=上传并复制链接 bettercrashes.gui.openCrashReport=打开崩溃报告 bettercrashes.gui.failed=[失败] bettercrashes.crashscreen.identificationErrored=[鉴别错误] @@ -9,14 +9,16 @@ bettercrashes.crashscreen.title=Minecraft崩溃啦! bettercrashes.crashscreen.summary=Minecraft遇到了一个问题并崩溃了。 bettercrashes.crashscreen.paragraph1.line1=下列模组被认为可能是导致崩溃的原因: bettercrashes.crashscreen.paragraph2.line1=一份报告已经生成,点击下方的按钮可以打开它: -bettercrashes.crashscreen.paragraph3.line1=我们建议您将此报告发送给模组的作者以帮助它们修复问题。 -bettercrashes.crashscreen.paragraph3.line2=由于安装了BetterCrashes,尽管发生了崩溃,你仍然可以继续进行游戏。 -bettercrashes.crashscreen.paragraph3.line3= +bettercrashes.crashscreen.paragraph3.line1=我们建议您将此报告的链接发送给模组的作者以帮助它们修复问题, +bettercrashes.crashscreen.paragraph3.line2=点击"上传并复制链接"即可上传报告并复制它的链接至剪贴板。 +bettercrashes.crashscreen.paragraph3.line3=由于安装了BetterCrashes,尽管发生了崩溃,你仍然可以继续进行游戏。 +bettercrashes.crashscreen.paragraph3.line4= bettercrashes.initerrorscreen.title=Minecraft未能启动! bettercrashes.initerrorscreen.summary=启动过程中的一个错误阻止了Minecraft的启动 bettercrashes.initerrorscreen.paragraph2.line1=一份报告已经生成,点击下方的按钮可以打开它: -bettercrashes.initerrorscreen.paragraph3.line1=我们建议您将此报告发送给模组的作者以帮助它们修复问题。 -bettercrashes.initerrorscreen.paragraph3.line2=由于安装了BetterCrashes,尽管发生了崩溃,你仍然可以继续进行游戏。 -bettercrashes.initerrorscreen.paragraph3.line3= +bettercrashes.initerrorscreen.paragraph3.line1=我们建议您将此报告的链接发送给模组的作者以帮助它们修复问题, +bettercrashes.initerrorscreen.paragraph3.line2=点击"上传并复制链接"即可上传报告并复制它的链接至剪贴板。 +bettercrashes.initerrorscreen.paragraph3.line3=由于安装了BetterCrashes,尽管发生了崩溃,你仍然可以继续进行游戏。 +bettercrashes.initerrorscreen.paragraph3.line4=