Skip to content

feat: 资源包管理 - #4475

Merged
Glavo merged 62 commits into
HMCL-dev:mainfrom
CiiLu:rp
Dec 6, 2025
Merged

feat: 资源包管理#4475
Glavo merged 62 commits into
HMCL-dev:mainfrom
CiiLu:rp

Conversation

@CiiLu

@CiiLu CiiLu commented Sep 13, 2025

Copy link
Copy Markdown
Contributor

TODO:

  • 支持启用禁用资源包
PixPin_2025-09-13_22-06-01

@zkitefly

zkitefly commented Sep 13, 2025

Copy link
Copy Markdown
Member

或许可以支持简介文本颜色显示?

@Glavo

Glavo commented Sep 18, 2025

Copy link
Copy Markdown
Member

请先处理 checkTranslations 的报错。

@CiiLu
CiiLu marked this pull request as draft September 18, 2025 13:37
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.properties Outdated
@CiiLu
CiiLu marked this pull request as ready for review September 24, 2025 14:22

@Glavo Glavo left a comment

Copy link
Copy Markdown
Member

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/java/org/jackhuang/hmcl/ui/versions/ResourcepackListPage.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ResourcepackListPage.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ResourcepackListPage.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ResourcepackListPage.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ResourcepackListPage.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ResourcepackListPage.java Outdated
Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/resourcepack/ResourcepackFile.java Outdated
Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/resourcepack/ResourcepackFile.java Outdated
Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/resourcepack/ResourcepackZipFile.java Outdated
Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/resourcepack/ResourcepackZipFile.java Outdated
@Glavo
Glavo requested a review from Copilot September 25, 2025 13:49

Copilot AI 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.

Pull Request Overview

This PR implements resource pack management functionality for HMCL, allowing users to view, add, and delete resource packs in their game instances.

  • Adds core resource pack file handling classes for both ZIP files and folder-based resource packs
  • Integrates resource pack management into the version page UI with a new tab
  • Provides localization strings for Chinese (Traditional/Simplified) and English

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ResourcepackZipFile.java Implements ZIP-based resource pack file handling with metadata parsing
ResourcepackFolder.java Implements folder-based resource pack file handling
ResourcepackFile.java Defines common interface and factory method for resource pack files
DefaultGameRepository.java Adds method to get resourcepacks directory path
I18N*.properties Adds localized strings for resource pack management UI
VersionPage.java Integrates resource pack tab into version page navigation
ResourcepackListPage.java Main UI page for resource pack management with add/delete functionality
DownloadPage.java Adds method to navigate to resource pack downloads

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +202 to +204
// left.getChildren().addAll(item.checkBox, createIcon(item.getFile().getIcon()));
left.setPadding(new Insets(0, 8, 0, 0));
// FXUtils.setLimitWidth(left, 64);

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

Remove commented-out code blocks. These appear to be related to unused checkbox functionality and should be cleaned up.

Copilot uses AI. Check for mistakes.
root.setLeft(left);

TwoLineListItem center = new TwoLineListItem();
// center.setPadding(new Insets(0, 0, 0, 8));

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

Remove commented-out code. If this padding adjustment was intentional, either apply it or remove the comment entirely.

Suggested change
// center.setPadding(new Insets(0, 0, 0, 8));

Copilot uses AI. Check for mistakes.
try (Stream<Path> stream = Files.list(resourcepackDirectory)) {
stream.forEach(path -> {
try {
itemsProperty().add(new ResourcepackItem(ResourcepackFile.parse(path)));

Copilot AI Sep 25, 2025

Copy link

Choose a reason for hiding this comment

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

ResourcepackFile.parse() can return null, but this code doesn't check for null before creating ResourcepackItem. Add a null check to prevent NullPointerException.

Suggested change
itemsProperty().add(new ResourcepackItem(ResourcepackFile.parse(path)));
ResourcepackFile resourcepackFile = ResourcepackFile.parse(path);
if (resourcepackFile != null) {
itemsProperty().add(new ResourcepackItem(resourcepackFile));
}

Copilot uses AI. Check for mistakes.

@Glavo Glavo left a comment

Copy link
Copy Markdown
Member

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/java/org/jackhuang/hmcl/ui/versions/ResourcepackListPage.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ResourcepackListPage.java Outdated
Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/resourcepack/ResourcepackMeta.java Outdated
Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/resourcepack/ResourcepackZipFile.java Outdated
Comment thread HMCLCore/src/main/java/org/jackhuang/hmcl/resourcepack/ResourcepackZipFile.java Outdated
@Glavo
Glavo merged commit ef3df92 into HMCL-dev:main Dec 6, 2025
2 checks passed
@CiiLu
CiiLu deleted the rp branch December 6, 2025 14:20
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] 资源包管理

5 participants