Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for creating/installing a game instance by dragging a Minecraft version-manifest-style JSON into the launcher, addressing feature request #5459 (install unlisted/ancient/third-party versions without manual folder setup).
Changes:
- Add i18n strings for “malformed instance JSON”.
- Add
Versions.installFromJson(Profile, Path)to parse a version JSON, write it into<gameDir>/versions/<id>/<id>.json, and trigger game jar download. - Extend drag-and-drop handlers (Root page + Game list page) to accept JSON files and invoke the new installer.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties | Adds zh_CN error message for invalid instance JSON. |
| HMCL/src/main/resources/assets/lang/I18N_zh.properties | Adds zh_TW error message for invalid instance JSON. |
| HMCL/src/main/resources/assets/lang/I18N.properties | Adds English error message for invalid instance JSON. |
| HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/Versions.java | Implements JSON-based instance installation + download flow. |
| HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java | Allows dragging .json into main page to trigger install. |
| HMCL/src/main/java/org/jackhuang/hmcl/ui/Controllers.java | Allows dragging files into game list page to trigger install. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| FXUtils.applyDragListener(gameListPage, ModpackHelper::isFileModpackByExtension, modpacks -> { | ||
| Path modpack = modpacks.get(0); | ||
| Controllers.getDecorator().startWizard(new ModpackInstallWizardProvider(Profiles.getSelectedProfile(), modpack), i18n("install.modpack")); | ||
| FXUtils.applyDragListener(gameListPage, file -> ModpackHelper.isFileModpackByExtension(file) || "json".equalsIgnoreCase(FileUtils.getNameWithoutExtension(file)), files -> { |
Comment on lines
+177
to
+179
| profile.getRepository().refreshVersions(); | ||
| profile.setSelectedVersion(result); | ||
| handler.resolve(); |
| }); | ||
| Task.runAsync(() -> { | ||
| var dir = profile.getGameDir().resolve("versions"); | ||
| var versionDir = Files.createDirectory(dir.resolve(result)); |
| install.new_game.current_game_version=Current Instance Version | ||
| install.new_game.installation=Instance Installation | ||
| install.new_game.malformed=Invalid name. | ||
| install.new_game.malformed_json=Invalid Minecraft instance JSON file。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves #5459