From 9ebf29d06015d936e57c1946ea75b27bdd1a7283 Mon Sep 17 00:00:00 2001 From: Glavo Date: Thu, 3 Sep 2026 21:16:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=201.4.7=20=E5=AE=89=E8=A3=85?= =?UTF-8?q?=20Legacy=20Fabric=20=E5=90=8E=E6=97=A0=E6=B3=95=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E5=90=AF=E5=8A=A8=E7=9A=84=E9=97=AE=E9=A2=98=20(#6807?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hmcl/game/LaunchManifestNormalizer.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchManifestNormalizer.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchManifestNormalizer.java index 49d4036e45..23c88ddf59 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchManifestNormalizer.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchManifestNormalizer.java @@ -70,8 +70,14 @@ public final class LaunchManifestNormalizer { // DefaultLauncher when building the process command). repaired = repairBootstrapLauncher(repaired, analyzer); } - // Vanilla and Fabric/Quilt need no loader-specific argument repair here. + if (analyzer.has(GameComponentType.LEGACY_FABRIC)) { + // LegacyFabric adds higher-version ASM dependencies such as org.ow2.asm:asm, + // which conflict with the original org.ow2.asm:asm-all and cause launch failure. + repaired = repairDuplicateAsm(repaired, analyzer); + } + + // Vanilla and Fabric/Quilt need no loader-specific argument repair here. return removeLegacyLog4jPatch(repaired); } @@ -216,6 +222,21 @@ public final class LaunchManifestNormalizer { return builder.build(); } + /// LegacyFabric adds higher-version ASM dependencies such as org.ow2.asm:asm, + /// which conflict with the original org.ow2.asm:asm-all and cause launch failure. + private static GameInstanceManifest repairDuplicateAsm(GameInstanceManifest manifest, GameComponentAnalyzer analyzer) { + if (!analyzer.has(GameComponentType.LEGACY_FABRIC)) { + return manifest; + } + + List libraries = manifest.getLibraries(); + + boolean hasAsm = libraries.stream().anyMatch(it -> it.is("org.ow2.asm", "asm")); + return hasAsm + ? manifest.withLibraries(libraries.stream().filter(it -> !it.is("org.ow2.asm", "asm-all")).toList()) + : manifest; + } + /// Returns whether a comma-separated list contains the exact requested value. private static boolean containsCommaSeparatedValue(String values, String target) { for (String value : values.split(",")) {