Skip to content

Conversation

@Mine-diamond
Copy link

@Mine-diamond Mine-diamond commented Oct 14, 2025

close #4661

重构Datapack类
工具栏在不同操作时改变内容
数据包搜索
显示数据包图标

image image image

@Mine-diamond Mine-diamond changed the title feat:优化数据包管理页面 feat:优化数据包管理功能 Oct 14, 2025
.forEach(info -> info.setActive(false));
}

void openDataPackFolder() {
Copy link
Contributor

Choose a reason for hiding this comment

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

感觉不需要单独做一个这个

@Mine-diamond
Copy link
Author

Mine-diamond commented Oct 25, 2025

修改了列表选择的逻辑:

  1. 单击条目会在选中/未选中间切换
  2. 点击条目只会影响该条目,而不像过去会取消选中其它条目
  3. Shift点击当后一次点击的条目为未选中,则选中两次Shift点击间的条目,否则为取消选中之间的条目
2025-10-26.23-15-49.720p.mp4

@Mine-diamond Mine-diamond marked this pull request as ready for review October 28, 2025 02:40
@Glavo Glavo requested a review from Copilot November 3, 2025 13:50
Copy link
Contributor

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 refactors the datapack management system with improved UI capabilities and cleaner code structure. The changes include restructuring the Datapack class, adding search and selection features to the UI, and improving the icon loading mechanism for datapacks.

  • Refactored Datapack class to use streams and functional programming patterns
  • Added search functionality with regex support for filtering datapacks
  • Implemented multi-select operations with shift-click support and improved toolbar states
  • Added icon loading for datapacks with proper caching and async handling

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 6 comments.

File Description
HMCLCore/src/main/java/org/jackhuang/hmcl/mod/Datapack.java Refactored datapack loading/installation logic using streams, renamed fields for clarity, and restructured Pack class with improved state management
HMCL/src/main/resources/assets/img/unknown_pack.png Added default placeholder image for datapacks without icons
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DatapackListPageSkin.java Added search bar, selection toolbar, icon loading with caching, and improved user interaction handling
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DatapackListPage.java Integrated search predicate logic and added method to open datapack folder
Comments suppressed due to low confidence (1)

HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DatapackListPageSkin.java:1

  • The inline comment explains why selectRange() is used instead of selectAll(), but this comment should be on line 129 where the method is called, not on line 128. This would make the rationale clearer for future maintainers.
/*

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (lastShiftClickIndex.get() == -1) {
lastShiftClickIndex.set(currentIndex);
toggleSelect.accept(cell.getIndex());
} else if (listView.getItems().size() >= lastShiftClickIndex.get() && !(lastShiftClickIndex.get() < -1)) {
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

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

The condition !(lastShiftClickIndex.get() < -1) is unnecessarily complex and confusing. This is equivalent to lastShiftClickIndex.get() >= -1, which should be simplified for better readability.

Suggested change
} else if (listView.getItems().size() >= lastShiftClickIndex.get() && !(lastShiftClickIndex.get() < -1)) {
} else if (listView.getItems().size() >= lastShiftClickIndex.get() && lastShiftClickIndex.get() >= -1) {

Copilot uses AI. Check for mistakes.
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] 为数据包管理添加取消选中的选项

3 participants