-
Notifications
You must be signed in to change notification settings - Fork 778
feat:优化数据包管理功能 #4672
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
base: main
Are you sure you want to change the base?
feat:优化数据包管理功能 #4672
Conversation
| .forEach(info -> info.setActive(false)); | ||
| } | ||
|
|
||
| void openDataPackFolder() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉不需要单独做一个这个
Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
|
修改了列表选择的逻辑:
2025-10-26.23-15-49.720p.mp4 |
There was a problem hiding this 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
Datapackclass 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 ofselectAll(), 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.
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DatapackListPageSkin.java
Show resolved
Hide resolved
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DatapackListPageSkin.java
Show resolved
Hide resolved
| if (lastShiftClickIndex.get() == -1) { | ||
| lastShiftClickIndex.set(currentIndex); | ||
| toggleSelect.accept(cell.getIndex()); | ||
| } else if (listView.getItems().size() >= lastShiftClickIndex.get() && !(lastShiftClickIndex.get() < -1)) { |
Copilot
AI
Nov 3, 2025
There was a problem hiding this comment.
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.
| } else if (listView.getItems().size() >= lastShiftClickIndex.get() && !(lastShiftClickIndex.get() < -1)) { | |
| } else if (listView.getItems().size() >= lastShiftClickIndex.get() && lastShiftClickIndex.get() >= -1) { |
close #4661
重构Datapack类
工具栏在不同操作时改变内容
数据包搜索
显示数据包图标