Skip to content

[Feature] 资源包管理 #4980 reforged#5774

Open
Calboot wants to merge 145 commits intoHMCL-dev:mainfrom
Calboot:resourcepack-enhancement
Open

[Feature] 资源包管理 #4980 reforged#5774
Calboot wants to merge 145 commits intoHMCL-dev:mainfrom
Calboot:resourcepack-enhancement

Conversation

@Calboot
Copy link
Copy Markdown
Contributor

@Calboot Calboot commented Mar 12, 2026

  • 资源包管理界面边框样式修复
  • 修复资源包依赖模组下载错误的问题
  • 资源包启用/禁用功能
  • 资源包详细信息界面
  • 与模组管理界面同步
  • 更新资源包

具体改动

See #4980

Calboot added 7 commits March 17, 2026 17:33
# Conflicts:
#	HMCL/src/main/java/org/jackhuang/hmcl/ui/download/DownloadPage.java
#	HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/AddonCheckUpdatesTask.java
#	HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPage.java
#	HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ModListPageSkin.java
#	HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ResourcepackListPage.java
#	HMCLCore/src/main/java/org/jackhuang/hmcl/mod/LocalModFile.java
#	HMCLCore/src/main/java/org/jackhuang/hmcl/resourcepack/ResourcepackFile.java
#	HMCLCore/src/main/java/org/jackhuang/hmcl/resourcepack/ResourcepackFolder.java
#	HMCLCore/src/main/java/org/jackhuang/hmcl/resourcepack/ResourcepackZipFile.java
@Glavo
Copy link
Copy Markdown
Member

Glavo commented Mar 29, 2026

image

为什么要有“适用于这个版本”的标签?这个标签完全没法提供有效信息。正常来说只需要提示不适用于当前版本的资源包就可以了。

@Calboot
Copy link
Copy Markdown
Contributor Author

Calboot commented Mar 29, 2026

为什么要有“适用于这个版本”的标签?这个标签完全没法提供有效信息。正常来说只需要提示不适用于当前版本的资源包就可以了。

已移除这个界面的这个标签。

但我保留了详细信息界面的这个标签,已表示我们确实会检测兼容性而非什么都不管。

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 3, 2026

已表示我们确实会检测兼容性而非什么都不管

我认为这种信息完全没有意义,模组管理页面也不会显示这种没有意义的东西。

@Calboot
Copy link
Copy Markdown
Contributor Author

Calboot commented Apr 3, 2026

我认为这种信息完全没有意义,模组管理页面也不会显示这种没有意义的东西。

removed

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 3, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5821e3600

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 4, 2026

/gemini review

Copy link
Copy Markdown

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

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 significant refactoring of the addon management system, establishing a generic base for both mods and resource packs through the LocalAddonFile and LocalAddonManager classes. It replaces the previous resource pack implementation with a more robust system that includes detailed compatibility checks based on PackMcMeta and unified update logic. Review feedback highlights opportunities to improve robustness by logging failures during file deletion, providing user-facing error messages when directory creation fails, and optimizing performance by batching configuration file writes during bulk operations.

@3gf8jv4dv
Copy link
Copy Markdown
Contributor

3gf8jv4dv commented Apr 5, 2026

碎碎念几句。

回顾来看,当时的「撤回」感觉操之过急。

尤其是合并后又突然评论「光顾着看代码了」「合并之后发现还是有很多问题」,给 PR 作者、其他活跃贡献者以及普通用户的观感并不太好。而且撤回理由也很含糊——看到了 mineDiamond 的评论才让人大致明白撤回的一个「动机」。

而且 force push 也不是一个可以随意在默认分支/主分支使用的操作——尤其是对于知名的、有多人协作的项目。这个 PR 也不涉及隐私啥的,哪怕再提交一个 revert commit 也好过 force push。直接 force push,让之前的 PR 看起来「合并」了,但却没有出现在 commit history 中,给其他查阅 commit / issue / PR 的用户带来了困惑和不解。

@3gf8jv4dv

This comment was marked as resolved.

@3gf8jv4dv

This comment was marked as resolved.

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 5, 2026

/gemini review

Copy link
Copy Markdown

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

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 refactors the addon management system by introducing a unified hierarchy for mods and resource packs through the LocalAddonManager and LocalAddonFile classes. It replaces the previous resource pack implementation with a more robust system that includes compatibility checking and update support for CurseForge and Modrinth. The UI has been updated to use generic components for addon updates and downloads. Review feedback suggests improving the UI by displaying filenames instead of full paths in error dialogs and ensuring consistency by using utility methods for zip file operations.

return i == 0 ? PackMcMeta.PackVersion.UNSPECIFIED : new PackMcMeta.PackVersion(i, 0);
}
}
try (var zipFileTree = new ZipFileTree(CompressingUtils.openZipFile(gameJar))) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For consistency with other parts of the resource pack management code (e.g., ResourcePackZipFile), consider using the CompressingUtils.openZipTree utility method here.

Suggested change
try (var zipFileTree = new ZipFileTree(CompressingUtils.openZipFile(gameJar))) {
try (var zipFileTree = CompressingUtils.openZipTree(gameJar)) {

@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 5, 2026

资源包管理界面中启用状态好像经常会和游戏中不一致?

image image

@3gf8jv4dv
Copy link
Copy Markdown
Contributor

又看了看 Glavo 给的图,我产生了一种微妙的感觉。

一个资源包条目的两行文字中,除了扩展名以外,两行文字一模一样。
这样的形式真的有意义、有美感吗?

既然目前第一行确定是显示资源包的文件名,那么可以把第二行改成显示 pack.mcmeta 中的 description 字段——这样也与游戏相呼应。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants