Skip to content

feat(mods): 实现模组列表导出功能#6233

Open
zkitefly wants to merge 23 commits into
HMCL-dev:mainfrom
zkitefly:modlist-output
Open

feat(mods): 实现模组列表导出功能#6233
zkitefly wants to merge 23 commits into
HMCL-dev:mainfrom
zkitefly:modlist-output

Conversation

@zkitefly

Copy link
Copy Markdown
Member

支持CSV和JSON格式,可自定义导出字段

要在模组列表选择要导出的项,然后就有导出清单按钮

close #6158

实现模组列表导出功能,支持CSV和JSON格式,可自定义导出字段

@3gf8jv4dv 3gf8jv4dv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

默认窗口大小下,对话框高度几乎撑满窗口了。要不限制一下?

Comment thread HMCL/src/main/resources/assets/lang/I18N_zh.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N_zh.properties Outdated
Comment thread HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties Outdated
zkitefly and others added 3 commits June 27, 2026 09:56
Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
@Minecraft269

Copy link
Copy Markdown

解决一下CheckStyle?

@Minecraft269

Copy link
Copy Markdown

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a feature to export the mod list to CSV or JSON format, including a UI dialog for selecting export formats and fields, and backend logic for generating the files and computing SHA1/SHA512 hashes. The review feedback highlights three critical improvements: offloading the export and hash computation to a background thread to prevent blocking the JavaFX UI thread, adding defensive null checks when retrieving mod field values to avoid potential NullPointerExceptions, and localizing the hardcoded English labels in the export dialog to support proper internationalization.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java Outdated
@ChouChiu

Copy link
Copy Markdown

会不会考虑做成 Prsim 那样,导出的格式更多一点,还能自定义

@Minecraft269

Copy link
Copy Markdown

话说支不支持mcmod的格式? (方便整合包作者)

@zkitefly

Copy link
Copy Markdown
Member Author

话说支不支持mcmod的格式? (方便整合包作者)

具体是什么格式

@Minecraft269

Copy link
Copy Markdown

话说支不支持mcmod的格式? (方便整合包作者)

具体是什么格式

https://www.mcmod.cn/class/2995.html https://bbs.mcmod.cn/thread-21260-1-1.html 应该是这种格式吧

@zkitefly

Copy link
Copy Markdown
Member Author

会不会考虑做成 Prsim 那样,导出的格式更多一点,还能自定义

已支持

@Minecraft269

Copy link
Copy Markdown

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a feature to export the mod list to CSV, JSON, or custom text formats asynchronously, complete with a configuration dialog in the UI and corresponding localization updates. The review feedback highlights several key areas for improvement: addressing thread-safety issues by replacing the remoteModInfoCache's HashMap with a ConcurrentHashMap, preventing potential NullPointerExceptions by adding null checks for fetched remote addons, improving error dialogs when exception.getMessage() is null, refactoring duplicated emoji-filtering logic, and resolving performance bottlenecks caused by sequential network requests during bulk exports.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java
@zkitefly zkitefly requested a review from 3gf8jv4dv June 27, 2026 14:36

@3gf8jv4dv 3gf8jv4dv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

我尝试在 Fabulously Optimized 里导出,但排最上面/最左边的不是模组名/模组 ID,而是 CF 的 URL。感觉如果人要去读的话不太友好。

Comment thread HMCL/src/main/resources/assets/lang/I18N.properties Outdated
mods.export.field.mod_loader_type=Mod Loader Type
mods.export.field.mcmod_id=MCMod ID
mods.export.field.abbr=Abbreviation
mods.export.field.chinese_name=Chinese Name

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这个字段是其他工具/模组会使用的么?建议明确一下「简体中文译名」

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

这个键值就这个功能用

🤔有点没明白意思

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

噢,我怕改了字段其他地方不兼容。其实我想建议改成 simpChineseName

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

噢,我怕改了字段其他地方不兼容。其实我想建议改成 simpChineseName

我看其他地方都是说 Chinese Name 的呀🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

我看其他地方都是说 Chinese Name 的呀🤔

看了下代码,确实。那就不动了。

extension.csv=CSV Files
extension.json=JSON Files
extension.txt=Text Files
button.export=Export

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

extension

@zkitefly

Copy link
Copy Markdown
Member Author

话说支不支持mcmod的格式? (方便整合包作者)

具体是什么格式

https://www.mcmod.cn/class/2995.html https://bbs.mcmod.cn/thread-21260-1-1.html 应该是这种格式吧

这里的网盘连接过期了,找不到源文件,也没有讲是啥格式(

@3gf8jv4dv

Copy link
Copy Markdown
Contributor

这里的网盘连接过期了,找不到源文件,也没有讲是啥格式(

我看了下,bbs.mcmod.cn 链接里说是用 https://www.mcmod.cn/class/2995.html 这个模组。

用这个模组导出的结构,和这个 PR JSON 格式的一致。

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.

[Feature] 在实例管理的模组列表中提供导出模组列表功能

4 participants