HMCL-dev / HMCL-dev/HMCL

[Feature] 增强下载功能:多线程加速与断点续传持久化

Open
#6,232 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
10.1k
Forks
934
Avg merge
1d 5h
Merged PRs (30d)
82

Description

当前HMCL的下载功能还是一言难尽 此issue也是为了下载功能提出 当前已有相关issue: https://github.com/HMCL-dev/HMCL/issues/1064 https://github.com/HMCL-dev/HMCL/pull/5435 且已经合并了 断点续传https://github.com/HMCL-dev/HMCL/pull/4558 但是呢 仍有大量有关于HMCL下载相关的反馈 目前已有https://github.com/HMCL-dev/HMCL/pull/6219 但是呢对于一些比较大或者网络链接得比较差的情况下仍会导致下载速度极其的慢 如图

Image

所以就有了此issue(此issue应该算作为 https://github.com/HMCL-dev/HMCL/issues/1064 的子issue)

注: 以下内容为AI生成 but 核心内容: 支持类似于IDM那样的下载方式(多线程下载、分段下载(多点连接)、文件分块、动态文件分割等等( DS ))

概述 | Summary

为 HMCL 引入多线程加速下载能力,并在现有断点续传基础上增强持久化支持——使下载任务在关闭 HMCL 后重新打开时仍可继续,同时优化下载体验的可见性与可控性。

原因 | Reason

目前 HMCL 的下载功能存在以下不足:

  • 大文件下载速度受限:游戏本体、整合包等大型资源下载耗时较长,单线程下载无法充分利用带宽。
  • 断点续传体验不明显:虽然已有基础支持,但用户难以感知其存在,且关闭 HMCL 后任务无法恢复,导致中断后需重新下载。
  • 缺乏下载进度可视化与管理:当前下载界面信息较为简略,用户无法便捷地暂停、恢复或查看详细进度。

引入多线程加速与断点续传持久化增强将带来:

  • 下载速度大幅提升:通过多线程将文件分割并行下载,显著缩短等待时间。
  • 真正的断点续传:关闭 HMCL 后再打开,未完成的任务仍可继续,尤其适合网络不稳定或需要关机的情况。
  • 更好的下载体验:清晰的进度展示、暂停/恢复控制,让用户对下载任务有充分的掌控感。

详情 | Description

1. 多线程下载核心
  • 支持可配置的连接线程数(建议默认 8 线程,上限 16 线程)
  • 实现文件分块下载与合并逻辑
  • 采用动态分段技术,根据网络状况实时调整分段大小
2. 断点续传持久化增强(基于 #5435 后台下载 PR)
  • 进度持久化存储:将下载进度(已完成的字节范围、文件分块状态)保存至本地,确保 HMCL 关闭后不丢失
  • 启动时自动检测:HMCL 启动时扫描未完成的下载任务,并提供“继续下载”或“放弃任务”的选项
  • 手动暂停/恢复:下载过程中支持用户主动暂停,并可随时恢复
  • 与 #5435 的集成:在后台下载功能的基础上,补充持久化存储与恢复逻辑,使后台下载任务在应用重启后依然可追踪
3. 下载任务管理界面增强
  • 提供独立的下载任务面板,展示所有进行中、已完成、已暂停的任务
  • 显示每个任务的实时进度、下载速度、剩余时间
  • 支持批量暂停/恢复/取消操作
4. 兼容性考虑
  • 需确保与现有下载源(如 CurseForge、Modrinth、BMCLAPI 等)的兼容性
  • 对已支持断点续传的服务器优先使用服务端续传能力,不支持则回退至客户端分块续传

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing download work in pull requests #5435, #6219, and #4558, along with parent issue #1064. Define the scope and architecture before implementation; done would require reliable multithreaded downloads, persistent resume after restart, task controls and visibility, and compatibility with the listed download sources.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.