Skip to content

Commit 2e77c17

Browse files
committed
Add mod status
1 parent c48994f commit 2e77c17

File tree

5 files changed

+39
-17
lines changed

5 files changed

+39
-17
lines changed

README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
# MoreCrashInfo
22
Display more info in crash report.
3-
4-
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.
5-
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.
3+
## Why make it?
4+
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.
5+
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.
6+
Mod list added by Forge in crash report is shown below:
7+
```
8+
Mod List:
9+
CustomSkinLoader_Forge-14.11-SNAPSHOT-89.jar CustomSkinLoader {customskinloader@14.11-SNAPSHOT-89 DONE}
10+
MoreCrashInfo-1.0.2.jar MoreCrashInfo {morecrashinfo@1.0.2 DONE}
11+
forge-1.14.4-28.0.23-universal.jar Forge {forge@28.0.23 DONE}
12+
```
13+
## What added?
14+
This mod is designed to take mod list and coremod list back with pretty printing.
15+
Feel free to open an issue if other info needed.
16+
What added in crash report is shown below:
617
```
718
Forge Mods:
8-
| ID | Name | Version | Source |
9-
| ---------------- | ---------------- | ----------------- | -------------------------------------------- |
10-
| minecraft | Minecraft | 1.14.3 | Not Found |
11-
| customskinloader | CustomSkinLoader | 14.11-SNAPSHOT-89 | CustomSkinLoader_Forge-14.11-SNAPSHOT-89.jar |
12-
| morecrashinfo | MoreCrashInfo | 1.0.1 | MoreCrashInfo-1.0.1.jar |
13-
| forge | Forge | 27.0.22 | forge-1.14.3-27.0.22-universal.jar |
19+
| ID | Name | Version | Source | Status |
20+
| ---------------- | ---------------- | ----------------- | -------------------------------------------- | ------ |
21+
| minecraft | Minecraft | 1.14.4 | Not Found | NONE |
22+
| customskinloader | CustomSkinLoader | 14.11-SNAPSHOT-89 | CustomSkinLoader_Forge-14.11-SNAPSHOT-89.jar | DONE |
23+
| morecrashinfo | MoreCrashInfo | 1.0.2 | MoreCrashInfo-1.0.2.jar | DONE |
24+
| forge | Forge | 28.0.23 | forge-1.14.4-28.0.23-universal.jar | DONE |
1425
Forge CoreMods:
15-
| ID | Name | Source | Status |
16-
| ---------------- | ------------ | --------------- | ------ |
17-
| customskinloader | transformers | transformers.js | Loaded |
26+
| ID | Name | Source | Status |
27+
| ---------------- | ------------------------- | ---------------------------- | ------ |
28+
| customskinloader | transformers | transformers.js | Loaded |
29+
| forge | fieldtomethodtransformers | fieldtomethodtransformers.js | Loaded |
1830
```

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
}
1111
apply plugin: 'net.minecraftforge.gradle'
1212

13-
version = '1.0.1'
13+
version = '1.0.2'
1414
group = 'me.xfl03'
1515
archivesBaseName = 'MoreCrashInfo'
1616

src/main/java/me/xfl03/morecrashinfo/crash/ModList.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ public String getLabel() {
1818
public String call() throws Exception {
1919
//Extend mod list text
2020
List<List<String>> datas = new ArrayList<>();
21-
datas.add(PrintHelper.createLine("ID", "Name", "Version", "Source"));
21+
datas.add(PrintHelper.createLine("ID", "Name", "Version", "Source", "Status"));
2222
List<ModInfo> mods = net.minecraftforge.fml.ModList.get().getMods();
2323
for (ModInfo it : mods) {
2424
datas.add(PrintHelper.createLine(
2525
it.getModId(),
2626
it.getDisplayName(),
2727
it.getVersion().toString(),
28-
ModHelper.getSource(it)
28+
ModHelper.getSource(it),
29+
ModHelper.getStatus(it.getModId())
2930
));
3031
}
3132
return PrintHelper.printLine("\n\t\t", datas);
3233
}
33-
3434
}

src/main/java/me/xfl03/morecrashinfo/util/ModHelper.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
import net.minecraftforge.coremod.CoreMod;
44
import net.minecraftforge.coremod.CoreModEngine;
55
import net.minecraftforge.coremod.CoreModProvider;
6+
import net.minecraftforge.fml.ModContainer;
7+
import net.minecraftforge.fml.ModList;
68
import net.minecraftforge.fml.loading.FMLLoader;
79
import net.minecraftforge.fml.loading.moddiscovery.CoreModFile;
810
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
911
import net.minecraftforge.forgespi.coremod.ICoreModFile;
1012
import net.minecraftforge.forgespi.coremod.ICoreModProvider;
1113

1214
import java.util.List;
15+
import java.util.Objects;
16+
import java.util.Optional;
1317

1418
public class ModHelper {
1519
public static List<CoreMod> getCoreModList() throws Exception {
@@ -42,4 +46,10 @@ public static String getName(ICoreModFile file) {
4246
}
4347
return name;
4448
}
49+
50+
public static String getStatus(String modId) {
51+
return ModList.get()
52+
.getModContainerById(modId).map(ModContainer::getCurrentState).map(Objects::toString)
53+
.orElse("NONE");
54+
}
4555
}

src/main/resources/META-INF/mods.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ loaderVersion="[25,)"
33
issueTrackerURL="http://github.com/xfl03/MoreCrashInfo/issues"
44
[[mods]]
55
modId="morecrashinfo"
6-
version="1.0.1"
6+
version="1.0.2"
77
displayName="MoreCrashInfo"
88
displayURL="http://github.com/xfl03/MoreCrashInfo" #optional
99
credits=""

0 commit comments

Comments
 (0)