Skip to content

Commit 1b1ba64

Browse files
authored
Fix 5963: 愚人节版本 Minecraft 2.0 的 Legacy Fabric 下载列表为空 (#6009)
1 parent e31268c commit 1b1ba64

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

HMCLCore/src/main/java/org/jackhuang/hmcl/download/legacyfabric/LegacyFabricVersionList.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ public Task<?> refreshAsync() {
5252
lock.writeLock().lock();
5353

5454
try {
55-
for (String gameVersion : gameVersions)
56-
for (String loaderVersion : loaderVersions)
55+
for (String metaGameVersion : gameVersions) {
56+
String gameVersion = normalizeVersion(metaGameVersion);
57+
for (String loaderVersion : loaderVersions) {
5758
versions.put(gameVersion, new LegacyFabricRemoteVersion(gameVersion, loaderVersion,
58-
Collections.singletonList(getLaunchMetaUrl(gameVersion, loaderVersion))));
59+
Collections.singletonList(getLaunchMetaUrl(metaGameVersion, loaderVersion))));
60+
}
61+
}
5962
} finally {
6063
lock.writeLock().unlock();
6164
}
@@ -71,6 +74,12 @@ private List<String> getGameVersions(String metaUrl) throws IOException {
7174
.stream().map(GameVersion::getVersion).collect(Collectors.toList());
7275
}
7376

77+
private static String normalizeVersion(String version) {
78+
return version.startsWith("2point0_")
79+
? "2.0_" + version.substring("2point0_".length())
80+
: version;
81+
}
82+
7483
private static String getLaunchMetaUrl(String gameVersion, String loaderVersion) {
7584
return String.format("https://meta.legacyfabric.net/v2/versions/loader/%s/%s", gameVersion, loaderVersion);
7685
}

0 commit comments

Comments
 (0)