diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java index 242ed9562..15192cd88 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java @@ -84,7 +84,12 @@ public class DownloadPage extends Control implements DecoratorPage { this.mod = ModTranslations.getModByCurseForgeId(addon.getSlug()); this.version = version; this.callback = callback; + loadModVersions(); + this.state.set(State.fromTitle(addon.getTitle())); + } + + private void loadModVersions() { File versionJar = StringUtils.isNotBlank(version.getVersion()) ? version.getProfile().getRepository().getVersionJar(version.getVersion()) : null; @@ -93,9 +98,9 @@ public class DownloadPage extends Control implements DecoratorPage { setFailed(false); Task.allOf( - Task.supplyAsync(() -> addon.getData().loadDependencies()), - Task.supplyAsync(() -> { - Stream versions = addon.getData().loadVersions(); + Task.supplyAsync(() -> addon.getData().loadDependencies()), + Task.supplyAsync(() -> { + Stream versions = addon.getData().loadVersions(); // if (StringUtils.isNotBlank(version.getVersion())) { // Optional gameVersion = GameVersion.minecraftVersion(versionJar); // if (gameVersion.isPresent()) { @@ -103,8 +108,8 @@ public class DownloadPage extends Control implements DecoratorPage { // .filter(file -> file.getGameVersions().contains(gameVersion.get()))); // } // } - return sortVersions(versions); - })) + return sortVersions(versions); + })) .whenComplete(Schedulers.javafx(), (result, exception) -> { if (exception == null) { @SuppressWarnings("unchecked") @@ -122,8 +127,6 @@ public class DownloadPage extends Control implements DecoratorPage { } setLoading(false); }).start(); - - this.state.set(State.fromTitle(addon.getTitle())); } private SimpleMultimap sortVersions(Stream versions) { @@ -297,6 +300,7 @@ public class DownloadPage extends Control implements DecoratorPage { return null; } }, getSkinnable().failedProperty())); + spinnerPane.setOnFailedAction(e -> getSkinnable().loadModVersions()); ComponentList list = new ComponentList(); StackPane.setAlignment(list, Pos.TOP_CENTER);