feat: 支持 1.1~1.6 版本安装 Forge - #6752
Conversation
| premain(agentArgs, inst); | ||
| } | ||
|
|
||
| private static class CoreFMLLibrariesTransformer implements ClassFileTransformer { |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck]
Class CoreFMLLibrariesTransformer should be declared as final.
|
|
||
| int magic = ((classBytes[pos++] & 0xFF) << 24) | | ||
| ((classBytes[pos++] & 0xFF) << 16) | | ||
| ((classBytes[pos++] & 0xFF) << 8) | |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.whitespace.SingleSpaceSeparatorCheck]
Use a single space to separate non-whitespace characters.
| premain(agentArgs, inst); | ||
| } | ||
|
|
||
| private static class CoreFMLLibrariesTransformer implements ClassFileTransformer { |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck]
Class CoreFMLLibrariesTransformer should be declared as final.
|
|
||
| int magic = ((classBytes[pos++] & 0xFF) << 24) | | ||
| ((classBytes[pos++] & 0xFF) << 16) | | ||
| ((classBytes[pos++] & 0xFF) << 8) | |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.whitespace.SingleSpaceSeparatorCheck]
Use a single space to separate non-whitespace characters.
| import static org.jackhuang.hmcl.util.StringUtils.removeSuffix; | ||
| import static org.jackhuang.hmcl.util.logging.Logger.LOG; | ||
|
|
||
| public class ForgeInstallation { |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck]
Class ForgeInstallation should be declared as final.
| } | ||
|
|
||
|
|
||
| /// Returns whether a Forge installer uses the processor-based format. |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck]
'//' has more than 1 empty lines before.
| import static org.jackhuang.hmcl.util.StringUtils.removeSuffix; | ||
| import static org.jackhuang.hmcl.util.logging.Logger.LOG; | ||
|
|
||
| public class ForgeInstallation { |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck]
Class ForgeInstallation should be declared as final.
| } | ||
|
|
||
|
|
||
| /// Returns whether a Forge installer uses the processor-based format. |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck]
'//' has more than 1 empty lines before.
|
|
||
| switch (type) { | ||
| case LEGACY -> | ||
| dependency = new ForgeLegacyInstallTask(dependencyManager, manifest, remote.getSelfVersion(), installer); |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck]
'lambda' child has incorrect indentation level 20, expected level should be 16.
| case LEGACY -> | ||
| dependency = new ForgeLegacyInstallTask(dependencyManager, manifest, remote.getSelfVersion(), installer); | ||
| case OLD -> | ||
| dependency = new ForgeOldInstallTask(dependencyManager, manifest, remote.getSelfVersion(), installer); |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck]
'lambda' child has incorrect indentation level 20, expected level should be 16.
| import static org.jackhuang.hmcl.util.StringUtils.removeSuffix; | ||
| import static org.jackhuang.hmcl.util.logging.Logger.LOG; | ||
|
|
||
| public class ForgeInstallation { |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck]
Class ForgeInstallation should be declared as final.
| } | ||
|
|
||
|
|
||
| /// Returns whether a Forge installer uses the processor-based format. |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck]
'//' has more than 1 empty lines before.
|
|
||
| switch (type) { | ||
| case LEGACY_MODLOADER, LEGACY_FML -> | ||
| dependency = new ForgeLegacyInstallTask(dependencyManager, manifest, remote.getSelfVersion(), installer, type); |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck]
'lambda' child has incorrect indentation level 20, expected level should be 16.
| case LEGACY_MODLOADER, LEGACY_FML -> | ||
| dependency = new ForgeLegacyInstallTask(dependencyManager, manifest, remote.getSelfVersion(), installer, type); | ||
| case OLD -> | ||
| dependency = new ForgeOldInstallTask(dependencyManager, manifest, remote.getSelfVersion(), installer); |
There was a problem hiding this comment.
[ERROR] [com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck]
'lambda' child has incorrect indentation level 20, expected level should be 16.
| Path forgeFile = gameRepository.getLayout().getLibraryFile(manifest.id(), forgeLibrary); | ||
| Files.createDirectories(forgeFile.getParent()); | ||
|
|
||
| try (InputStream is = Files.newInputStream(installer); OutputStream os = Files.newOutputStream(forgeFile, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { |
There was a problem hiding this comment.
这里是不是可以用 FileUtils::copyFile 啊
|
@zkitefly 这个是 Forge 版本的搜索框,1.4.0 Forge 版本是 5.0.0.x…… EDIT: 这个意思是版本没刷新出来吗? |
他应该是说这个版本的Forge为什么没有?
是的 |
|
我看了下,官方源有内容的,但 mirror 为空。 |
|
https://github.com/HMCL-dev/HMCL/actions/runs/33285224736/job/99187149416 下面是测试无模组启动失败的日志 去除 Forge 后能正常启动
1.5.2
minecraft-exported-logs-2026-08-30T15-08-18.log 1.5.1
minecraft-exported-logs-2026-08-30T15-10-27.log 1.5
minecraft-exported-logs-2026-08-30T15-13-04.log 1.4.7
minecraft-exported-logs-2026-08-30T15-14-44.log 1.4.6、1.4.5、1.4.4、1.4.3、1.4.2、1.4.1、1.3.2 报错内容和日志一致,就不一直重复了…… 1.2.3 minecraft-exported-logs-2026-08-30T14-49-14.log minecraft-exported-jstack-dump-2026-08-30T14-50-01.log 表现为启动器一直等待启动但实际已失败 1.2.4 minecraft-exported-logs-2026-08-30T14-54-11.log minecraft-exported-jstack-dump-2026-08-30T14-54-53.log 表现为启动器一直等待启动但实际已失败 |
bmclapi 没有保存非 installer jar 的 forge 版本,HMCL 是通过 https://hmcl-dev.github.io/metadata/forge/index.json 获取列表的,列表是根据 forge maven https://maven.minecraftforge.net/net/minecraftforge/forge/maven-metadata.xml 整理的列表
MC 1.4 的 id 为 |
|
|
||
| private static final String TARGET_URL = "http://files.minecraftforge.net/fmllibs/%s"; | ||
|
|
||
| private static String newRootUrl = "https://https://hmcl.glavo.site/metadata/fmllibs/%s"; |








resolves #6733
LegacyForgeHelper 与 ModloaderHelper 由 Gemini 3.7 Flash 完成。
不支持读取外部安装的 Forge。
由于 LegacyForgeHelper 与 ModloaderHelper 需要兼容到 Java 6,所以指定使用了 JDK 8 编译,合并前需要确定构建机是否存在 JDK 8。