优化 TaskListPane 的显示效果 (#4306)

Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
This commit is contained in:
Glavo
2025-08-21 16:45:07 +08:00
committed by GitHub
parent 9ee55cd17d
commit 96f2d011ca
9 changed files with 49 additions and 8 deletions

View File

@@ -48,6 +48,7 @@ public class DefaultGameBuilder extends GameBuilder {
Task<Version> libraryTask = Task.supplyAsync(() -> new Version(name));
libraryTask = libraryTask.thenComposeAsync(libraryTaskHelper(gameVersion, "game", gameVersion));
stages.add("hmcl.install.game:" + gameVersion);
stages.add("hmcl.install.libraries");
stages.add("hmcl.install.assets");
for (Map.Entry<String, String> entry : toolVersions.entrySet()) {

View File

@@ -75,6 +75,7 @@ public final class GameLibrariesTask extends Task<Void> {
this.integrityCheck = integrityCheck;
this.libraries = libraries;
setStage("hmcl.install.libraries");
setSignificance(TaskSignificance.MODERATE);
}
@@ -115,6 +116,7 @@ public final class GameLibrariesTask extends Task<Void> {
@Override
public void execute() throws IOException {
int progress = 0;
GameRepository gameRepository = dependencyManager.getGameRepository();
for (Library library : libraries) {
if (!library.appliesToCurrentEnvironment()) {
@@ -135,10 +137,17 @@ public final class GameLibrariesTask extends Task<Void> {
}
}
if (shouldDownloadLibrary(gameRepository, version, library, integrityCheck) && (library.hasDownloadURL() || !"optifine".equals(library.getGroupId()))) {
dependencies.add(new LibraryDownloadTask(dependencyManager, file, library));
dependencies.add(new LibraryDownloadTask(dependencyManager, file, library).withCounter("hmcl.install.libraries"));
} else {
dependencyManager.getCacheRepository().tryCacheLibrary(library, file.toPath());
}
updateProgress(++progress, libraries.size());
}
if (!dependencies.isEmpty()) {
getProperties().put("total", dependencies.size());
notifyPropertiesChanged();
}
}