Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a "Reset Instance" feature to the HMCL Minecraft launcher, allowing users to reinstall a game instance while preserving save files, mods, and other game data. This feature helps resolve issues caused by missing or corrupted game files (e.g., when libraries folder is not copied during instance migration), providing a convenient recovery option similar to features found in other launchers like PCLCE and BakaXL.
Changes:
- Added
getLibraries()method to LibraryAnalyzer to retrieve all detected library types for an instance - Implemented
resetVersion()functionality that rebuilds an instance by reinstalling all detected libraries while preserving user data - Added UI integration with confirmation dialog and menu item in the instance management menu
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| HMCLCore/src/main/java/org/jackhuang/hmcl/download/LibraryAnalyzer.java | Added getLibraries() method to return set of detected LibraryType values |
| HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java | Implemented resetVersion() method that analyzes and rebuilds instance libraries |
| HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionPage.java | Added resetInstance() UI handler with confirmation dialog and menu integration |
| HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties | Added Simplified Chinese translations for reset feature |
| HMCL/src/main/resources/assets/lang/I18N_zh.properties | Added Traditional Chinese translations for reset feature |
| HMCL/src/main/resources/assets/lang/I18N.properties | Added English translations for reset feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42e2df1400
ℹ️ 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".
|
@codex review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a 'Reset Instance' feature, allowing users to reinstall the game core while preserving personal data such as worlds and mods. The implementation includes UI updates to the version management page, new localization strings, and the core logic for rebuilding the game instance. A review comment suggests refining the exception handling in the resetVersion method, as the current catch block is too broad and may mask unexpected runtime errors.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca4a4cf742
ℹ️ 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".
| Controllers.taskDialog(builder.buildAsync() | ||
| .thenRunAsync(repository::refreshVersions) |
There was a problem hiding this comment.
Avoid deleting instance directory on reset failure
Calling builder.buildAsync() here reuses DefaultGameBuilder, whose failure handler removes the target version directory (HMCLCore/src/main/java/org/jackhuang/hmcl/download/DefaultGameBuilder.java:63-66). During reset, that target is the existing instance ID, so any download/install failure can delete the whole instance folder (including saves/mods for VERSION_FOLDER instances), while the rollback only rewrites the JSON and cannot restore deleted data. This contradicts the reset guarantee that user data is preserved and makes transient network failures destructive.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
我感觉提供一个这样的功能是很方便的。
混用启动器或者复制 Forge 游戏文件时没有同时复制
libraries文件夹等行为会导致游戏无法启动,这种一般需要手动重新安装同版本游戏,前者还需要迁移存档等文件。在启动器里提供一个基本没有副作用的快捷操作很方便,且 PCLCE、BakaXL等启动器也提供了类似的操作。
提供重置实例功能同时可以解决外部安装实例的自动安装无法操作的问题。