diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CrashReportAnalyzer.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CrashReportAnalyzer.java index 986dcc781..1829d8f9c 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CrashReportAnalyzer.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CrashReportAnalyzer.java @@ -92,7 +92,7 @@ public final class CrashReportAnalyzer { DEBUG_CRASH(Pattern.compile("Manually triggered debug crash")), CONFIG(Pattern.compile("Failed loading config file (?.*?) of type (.*?) for modid (?.*)"), "id", "file"), // Fabric gives some warnings - FABRIC_WARNINGS(Pattern.compile("(Warnings were found!|Incompatible mod set!)(.*?)[\\n\\r]+(?[^\\[]+)\\["), "reason"), + FABRIC_WARNINGS(Pattern.compile("(Warnings were found!|Incompatible mod set!|Incompatible mods found!)(.*?)[\\n\\r]+(?[^\\[]+)\\["), "reason"), // Game crashed when ticking entity ENTITY(Pattern.compile("Entity Type: (?.*)[\\w\\W\\n\\r]*?Entity's Exact location: (?.*)"), "type", "location"), // Game crashed when tesselating block model diff --git a/HMCLCore/src/test/java/org/jackhuang/hmcl/game/CrashReportAnalyzerTest.java b/HMCLCore/src/test/java/org/jackhuang/hmcl/game/CrashReportAnalyzerTest.java index 49853c930..9500ba1fa 100644 --- a/HMCLCore/src/test/java/org/jackhuang/hmcl/game/CrashReportAnalyzerTest.java +++ b/HMCLCore/src/test/java/org/jackhuang/hmcl/game/CrashReportAnalyzerTest.java @@ -370,6 +370,22 @@ public class CrashReportAnalyzerTest { result.getMatcher().group("reason").replaceAll("\\s+", "")); } + @Test + public void fabricWarnings2() throws IOException { + CrashReportAnalyzer.Result result = findResultByRule( + CrashReportAnalyzer.anaylze(loadLog("/logs/fabric_warnings3.txt")), + CrashReportAnalyzer.Rule.FABRIC_WARNINGS); + assertEquals(("net.fabricmc.loader.impl.FormattedException: Some of your mods are incompatible with the game or each other!\n" + + "确定了一种可能的解决方法,这样做可能会解决你的问题:\n" + + "\t - 安装 fabric-api,任意版本。\n" + + "\t - 安装 sodium,0.5.6 及以上版本。\n" + + "更多信息:\n" + + "\t - 模组 'Sodium Extra' (sodium-extra) 0.5.4+mc1.20.4-build.116 需要 fabric-api 的 任意版本,但没有安装它!\n" + + "\t - 模组 'Sodium Extra' (sodium-extra) 0.5.4+mc1.20.4-build.116 需要 sodium 的 0.5.6 及以上版本,但没有安装它!\n" + + "\tat net.fabricmc.loader.impl.FormattedException.ofLocalized(FormattedException.java:51) ~").replaceAll("\\s+", ""), + result.getMatcher().group("reason").replaceAll("\\s+", "")); + } + @Test public void fabricConflicts() throws IOException { CrashReportAnalyzer.Result result = findResultByRule( diff --git a/HMCLCore/src/test/resources/logs/fabric_warnings3.txt b/HMCLCore/src/test/resources/logs/fabric_warnings3.txt new file mode 100644 index 000000000..e8de25b08 --- /dev/null +++ b/HMCLCore/src/test/resources/logs/fabric_warnings3.txt @@ -0,0 +1,18 @@ +[01:27:16] [main/INFO]: Loading Minecraft 1.20.4 with Fabric Loader 0.15.6 +[01:27:16] [main/WARN]: Mod resolution failed +[01:27:16] [main/INFO]: Immediate reason: [HARD_DEP_NO_CANDIDATE sodium-extra 0.5.4+mc1.20.4-build.116 {depends fabric-api @ [*]}, ROOT_FORCELOAD_SINGLE sodium-extra 0.5.4+mc1.20.4-build.116] +[01:27:16] [main/INFO]: Reason: [HARD_DEP sodium-extra 0.5.4+mc1.20.4-build.116 {depends fabric-api @ [*]}, HARD_DEP sodium-extra 0.5.4+mc1.20.4-build.116 {depends sodium @ [>=0.5.6]}] +[01:27:16] [main/INFO]: Fix: add [add:fabric-api 1 ([(-∞,∞)]), add:sodium 0.5.6 ([[0.5.6,∞)])], remove [], replace [] +[01:27:17] [main/ERROR]: Incompatible mods found! +net.fabricmc.loader.impl.FormattedException: Some of your mods are incompatible with the game or each other! +确定了一种可能的解决方法,这样做可能会解决你的问题: + - 安装 fabric-api,任意版本。 + - 安装 sodium,0.5.6 及以上版本。 +更多信息: + - 模组 'Sodium Extra' (sodium-extra) 0.5.4+mc1.20.4-build.116 需要 fabric-api 的 任意版本,但没有安装它! + - 模组 'Sodium Extra' (sodium-extra) 0.5.4+mc1.20.4-build.116 需要 sodium 的 0.5.6 及以上版本,但没有安装它! + at net.fabricmc.loader.impl.FormattedException.ofLocalized(FormattedException.java:51) ~[fabric-loader-0.15.6.jar:?] + at net.fabricmc.loader.impl.FabricLoaderImpl.load(FabricLoaderImpl.java:195) ~[fabric-loader-0.15.6.jar:?] + at net.fabricmc.loader.impl.launch.knot.Knot.init(Knot.java:146) ~[fabric-loader-0.15.6.jar:?] + at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:68) ~[fabric-loader-0.15.6.jar:?] + at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.15.6.jar:?]