Skip to content

添加 Modrinth 整合包导出 #3716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 45 commits into
base: main
Choose a base branch
from

Conversation

zkitefly
Copy link
Member

@zkitefly zkitefly commented Mar 7, 2025

_dde-file-manager_20250308020906.mp4

Fabulously Optimized.mrpack.zip

可能需要改进翻译

HMCL-3.6.SNAPSHOT.zip 测试版本

Copy link
Contributor

@3gf8jv4dv 3gf8jv4dv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文案建议(English)

其他语言稍后

挺9的
Copy link
Contributor

@3gf8jv4dv 3gf8jv4dv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文案建议(简体中文)

Copy link
Contributor

@3gf8jv4dv 3gf8jv4dv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文案建议(繁體中文)

Copy link
Contributor

@3gf8jv4dv 3gf8jv4dv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文案建议(Español)

@3gf8jv4dv
Copy link
Contributor

俄语和日语似乎少了 modpack.type.modrinth.export

zkitefly and others added 15 commits March 8, 2025 14:20
@zkitefly
Copy link
Member Author

a4d0569 更新了 modpack.wizard.step.initialization.modrinth.info 的翻译,但日文、俄文和西班牙语没改,需要帮助(

@zkitefly zkitefly requested a review from 3gf8jv4dv March 10, 2025 12:47
@zkitefly
Copy link
Member Author

@Glavo cc?

@zkitefly
Copy link
Member Author

@Glavo 有计划在稳定版前合并吗(

@Glavo Glavo requested review from Copilot and removed request for 3gf8jv4dv May 31, 2025 15:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for exporting modpacks in the Modrinth format. It introduces a new export task, updates modpack export configuration to include flags for remote resource matching, adjusts the modpack blacklist accordingly, and modifies UI pages and language files for consistent Modrinth integration.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/modrinth/ModrinthModpackExportTask.java New export task for creating Modrinth modpacks and handling remote file matching.
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModpackExportInfo.java Added new boolean flags and options to control remote file matching behavior.
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModAdviser.java Updated modpack blacklist with additional rules including entries for Modrinth exports.
HMCL/src/main/resources/assets/lang/*.properties Added new translation keys and updated strings for Modrinth-related export parameters.
HMCL/src/main/java/org/jackhuang/hmcl/ui/export/*.java Modified modpack selection and export info pages to include Modrinth as an export option with corresponding file extension and toggle controls.
HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ExportWizardProvider.java Integrated the new Modrinth export task into the export wizard flow.

@zkitefly zkitefly requested review from 3gf8jv4dv and removed request for 3gf8jv4dv May 31, 2025 16:08
return;
}

ModrinthManifest.File fileEntry = tryGetRemoteFile(file, relativePath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请避免同步网络请求,应将请求下载源数据的代码分离至独立的 Task,并使用 getDependencies / getDependents 来链接到 ModrinthModpackExportTask。

try {
modrinthVersion = ModrinthRemoteModRepository.MODS.getRemoteVersionByLocalFile(localModFile, file);
} catch (IOException e) {
LOG.warning("Failed to get remote file from Modrinth for: " + file, e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用户若错误地在无网情况下导出整合包,则不会收到任何提示但未能将模组本体排除至整合包之外

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

也就是说请求失败就直接终止导出?

blackList.add(version + ".jar");
blackList.add(version + ".json");
LOG.info("Compressing game files without some files in blacklist, including files or directories: usernamecache.json, asm, logs, backups, versions, assets, usercache.json, libraries, crash-reports, launcher_profiles.json, NVIDIA, TCNodeTracker");
try (Zipper zip = new Zipper(modpackFile.toPath())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新代码应避免使用 Zipper。请转向 CompressingUtils 中构造的 FileSystem

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新代码应避免使用 Zipper。请转向 CompressingUtils 中构造的 FileSystem

新代码请不要使用 FileSystem,尤其是不应该使用 FileSystem 写入 ZIP 文件,这存在相当多问题。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新代码应避免使用 Zipper。请转向 CompressingUtils 中构造的 FileSystem

新代码请不要使用 FileSystem,尤其是不应该使用 FileSystem 写入 ZIP 文件,这存在相当多问题。

请求在另一个 Issue 中列出目前 jrt FileSystem 存在的问题。FileSystem 相较于 Zipper / Unzipper / ZipArchiveReader 有较高自由度。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那就先保持这样?因为 MMC 和 MCBBS 整合包都是使用 Zipper

@@ -747,7 +748,10 @@ modpack.wizard.step.3.title=选择整合包导出类型
modpack.wizard.step.initialization.exported_version=要导出的游戏版本
modpack.wizard.step.initialization.force_update=强制升级整合包至最新版本 (需要自建服务器)
modpack.wizard.step.initialization.include_launcher=包含启动器
modpack.wizard.step.initialization.modrinth.info=在整合包创建过程中,启动器将匹配 CurseForge/Modrinth 远程资源替代本地文件(包括模组、资源包和光影包)以缩减整合包体积,并将扩展名为“.disabled”的文件标注为“安装时可选项”。
modpack.wizard.step.initialization.no_create_remote_files=不匹配远程文件
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个选项的功能感觉太难理解了,不看代码的话我是不知道这个选项是什么意思。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果这两个选项不是必要的话,那建议先不引入,后续再讨论是否要引入,该起什么名字。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更名为“打包资源文件”如何?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants