Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
Update crash report uoloader
Browse files Browse the repository at this point in the history
  • Loading branch information
vfyjxf committed Jul 29, 2021
1 parent ed1dd95 commit 70650e9
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 50 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 2 additions & 10 deletions src/main/java/vfyjxf/bettercrashes/BetterCrashes.java
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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"));
}

}
7 changes: 4 additions & 3 deletions src/main/java/vfyjxf/bettercrashes/utils/GuiCrashScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}
29 changes: 13 additions & 16 deletions src/main/java/vfyjxf/bettercrashes/utils/GuiProblemScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());
Expand All @@ -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
Expand Down
17 changes: 9 additions & 8 deletions src/main/resources/assets/bettercrashes/lang/en_US.lang
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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.
16 changes: 9 additions & 7 deletions src/main/resources/assets/bettercrashes/lang/zh_CN.lang
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bettercrashes.gui.uploadReportAndCopyLink=复制链接到剪贴板
bettercrashes.gui.uploadReportAndCopyLink=上传并复制链接
bettercrashes.gui.openCrashReport=打开崩溃报告
bettercrashes.gui.failed=[失败]
bettercrashes.crashscreen.identificationErrored=[鉴别错误]
Expand All @@ -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=

0 comments on commit 70650e9

Please sign in to comment.