Skip to content

Commit

Permalink
Add mod status
Browse files Browse the repository at this point in the history
  • Loading branch information
xfl03 committed Jul 29, 2019
1 parent c48994f commit 2e77c17
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 17 deletions.
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 {[email protected] DONE}
MoreCrashInfo-1.0.2.jar MoreCrashInfo {[email protected] DONE}
forge-1.14.4-28.0.23-universal.jar Forge {[email protected] 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 |
```
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}
apply plugin: 'net.minecraftforge.gradle'

version = '1.0.1'
version = '1.0.2'
group = 'me.xfl03'
archivesBaseName = 'MoreCrashInfo'

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/me/xfl03/morecrashinfo/crash/ModList.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ public String getLabel() {
public String call() throws Exception {
//Extend mod list text
List<List<String>> datas = new ArrayList<>();
datas.add(PrintHelper.createLine("ID", "Name", "Version", "Source"));
datas.add(PrintHelper.createLine("ID", "Name", "Version", "Source", "Status"));
List<ModInfo> 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);
}

}
10 changes: 10 additions & 0 deletions src/main/java/me/xfl03/morecrashinfo/util/ModHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
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;
import net.minecraftforge.forgespi.coremod.ICoreModFile;
import net.minecraftforge.forgespi.coremod.ICoreModProvider;

import java.util.List;
import java.util.Objects;
import java.util.Optional;

public class ModHelper {
public static List<CoreMod> getCoreModList() throws Exception {
Expand Down Expand Up @@ -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");
}
}
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down

0 comments on commit 2e77c17

Please sign in to comment.