diff --git a/README.md b/README.md index 4a74cdc..b643d3b 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,30 @@ # MoreCrashInfo Display more info in crash report. - -As we all know, Forge 1.13.2 - 1.14.4 removes mod list and coremod list in crash report, which makes users difficult to analyze what happened. -This mod is designed to take it back. More info will be shown in crash report, and feel free to open an issue if other info needed. +## Why make it? +Forge 1.13.2 - 1.14.3 removed mod list and coremod list in crash report, while users need them to analyze which mod caused crash. +Forge 1.14.4 added mod list back, but it is not formatted. It's hard to read when plenty of mods loaded. Coremods list is still not shown. +Mod list added by Forge in crash report is shown below: +``` +Mod List: + CustomSkinLoader_Forge-14.11-SNAPSHOT-89.jar CustomSkinLoader {customskinloader@14.11-SNAPSHOT-89 DONE} + MoreCrashInfo-1.0.2.jar MoreCrashInfo {morecrashinfo@1.0.2 DONE} + forge-1.14.4-28.0.23-universal.jar Forge {forge@28.0.23 DONE} +``` +## What added? +This mod is designed to take mod list and coremod list back with pretty printing. +Feel free to open an issue if other info needed. +What added in crash report is shown below: ``` Forge Mods: - | ID | Name | Version | Source | - | ---------------- | ---------------- | ----------------- | -------------------------------------------- | - | minecraft | Minecraft | 1.14.3 | Not Found | - | customskinloader | CustomSkinLoader | 14.11-SNAPSHOT-89 | CustomSkinLoader_Forge-14.11-SNAPSHOT-89.jar | - | morecrashinfo | MoreCrashInfo | 1.0.1 | MoreCrashInfo-1.0.1.jar | - | forge | Forge | 27.0.22 | forge-1.14.3-27.0.22-universal.jar | + | ID | Name | Version | Source | Status | + | ---------------- | ---------------- | ----------------- | -------------------------------------------- | ------ | + | minecraft | Minecraft | 1.14.4 | Not Found | NONE | + | customskinloader | CustomSkinLoader | 14.11-SNAPSHOT-89 | CustomSkinLoader_Forge-14.11-SNAPSHOT-89.jar | DONE | + | morecrashinfo | MoreCrashInfo | 1.0.2 | MoreCrashInfo-1.0.2.jar | DONE | + | forge | Forge | 28.0.23 | forge-1.14.4-28.0.23-universal.jar | DONE | Forge CoreMods: - | ID | Name | Source | Status | - | ---------------- | ------------ | --------------- | ------ | - | customskinloader | transformers | transformers.js | Loaded | + | ID | Name | Source | Status | + | ---------------- | ------------------------- | ---------------------------- | ------ | + | customskinloader | transformers | transformers.js | Loaded | + | forge | fieldtomethodtransformers | fieldtomethodtransformers.js | Loaded | ``` diff --git a/build.gradle b/build.gradle index f5eb0df..99829e7 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { } apply plugin: 'net.minecraftforge.gradle' -version = '1.0.1' +version = '1.0.2' group = 'me.xfl03' archivesBaseName = 'MoreCrashInfo' diff --git a/src/main/java/me/xfl03/morecrashinfo/crash/ModList.java b/src/main/java/me/xfl03/morecrashinfo/crash/ModList.java index ecb9692..5265c6f 100644 --- a/src/main/java/me/xfl03/morecrashinfo/crash/ModList.java +++ b/src/main/java/me/xfl03/morecrashinfo/crash/ModList.java @@ -18,17 +18,17 @@ public String getLabel() { public String call() throws Exception { //Extend mod list text List> datas = new ArrayList<>(); - datas.add(PrintHelper.createLine("ID", "Name", "Version", "Source")); + datas.add(PrintHelper.createLine("ID", "Name", "Version", "Source", "Status")); List mods = net.minecraftforge.fml.ModList.get().getMods(); for (ModInfo it : mods) { datas.add(PrintHelper.createLine( it.getModId(), it.getDisplayName(), it.getVersion().toString(), - ModHelper.getSource(it) + ModHelper.getSource(it), + ModHelper.getStatus(it.getModId()) )); } return PrintHelper.printLine("\n\t\t", datas); } - } diff --git a/src/main/java/me/xfl03/morecrashinfo/util/ModHelper.java b/src/main/java/me/xfl03/morecrashinfo/util/ModHelper.java index 6f573c1..7de0af6 100644 --- a/src/main/java/me/xfl03/morecrashinfo/util/ModHelper.java +++ b/src/main/java/me/xfl03/morecrashinfo/util/ModHelper.java @@ -3,6 +3,8 @@ import net.minecraftforge.coremod.CoreMod; import net.minecraftforge.coremod.CoreModEngine; import net.minecraftforge.coremod.CoreModProvider; +import net.minecraftforge.fml.ModContainer; +import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.moddiscovery.CoreModFile; import net.minecraftforge.fml.loading.moddiscovery.ModInfo; @@ -10,6 +12,8 @@ import net.minecraftforge.forgespi.coremod.ICoreModProvider; import java.util.List; +import java.util.Objects; +import java.util.Optional; public class ModHelper { public static List getCoreModList() throws Exception { @@ -42,4 +46,10 @@ public static String getName(ICoreModFile file) { } return name; } + + public static String getStatus(String modId) { + return ModList.get() + .getModContainerById(modId).map(ModContainer::getCurrentState).map(Objects::toString) + .orElse("NONE"); + } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 9ab32c0..40575c3 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -3,7 +3,7 @@ loaderVersion="[25,)" issueTrackerURL="http://github.com/xfl03/MoreCrashInfo/issues" [[mods]] modId="morecrashinfo" -version="1.0.1" +version="1.0.2" displayName="MoreCrashInfo" displayURL="http://github.com/xfl03/MoreCrashInfo" #optional credits=""