From 5f8f01e0ab0009dd419a9ccc8bb8084baced8a24 Mon Sep 17 00:00:00 2001 From: Yuhui Huang Date: Wed, 28 Jul 2021 16:15:11 +0800 Subject: [PATCH] Revert "fix: Version.jar should be resolved to id of self if null instead of the id of ancestor.". Closes #934. This reverts commit 5de150b06e85603d6e34ee3db29ad6e285394d66. --- .gitignore | 1 + .../src/main/java/org/jackhuang/hmcl/game/Version.java | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 89a91bf97..1ccd5382b 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ NVIDIA # test /hmcl.json +/.hmcl.json diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java index 7e090fb46..bcc491533 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java @@ -163,7 +163,7 @@ public class Version implements Comparable, Validation { } public String getJar() { - return jar == null ? id : jar; + return jar; } public String getInheritsFrom() { @@ -275,14 +275,14 @@ public class Version implements Comparable, Validation { if (inheritsFrom == null) { if (isRoot()) - thisVersion = new Version(id).setPatches(patches); + thisVersion = new Version(id).setPatches(patches).setJar(id); else - thisVersion = this; + thisVersion = this.jar == null ? this.setJar(id) : this; } else { // To maximize the compatibility. if (!resolvedSoFar.add(id)) { Logging.LOG.log(Level.WARNING, "Found circular dependency versions: " + resolvedSoFar); - thisVersion = this; + thisVersion = this.jar == null ? this.setJar(id) : this; } else { // It is supposed to auto install an version in getVersion. thisVersion = merge(provider.getVersion(inheritsFrom).resolve(provider, resolvedSoFar), false);