Fix 5963: 愚人节版本 Minecraft 2.0 的 Legacy Fabric 下载列表为空 (#6009)
This commit is contained in:
1 parent
e31268c39d
commit
1b1ba64a38
1 file changed
+12
-3
+12
-3
@@ -52,10 +52,13 @@ public final class LegacyFabricVersionList extends VersionList<LegacyFabricRemot
|
||||
lock.writeLock().lock();
|
||||
|
||||
try {
|
||||
for (String gameVersion : gameVersions)
|
||||
for (String loaderVersion : loaderVersions)
|
||||
for (String metaGameVersion : gameVersions) {
|
||||
String gameVersion = normalizeVersion(metaGameVersion);
|
||||
for (String loaderVersion : loaderVersions) {
|
||||
versions.put(gameVersion, new LegacyFabricRemoteVersion(gameVersion, loaderVersion,
|
||||
Collections.singletonList(getLaunchMetaUrl(gameVersion, loaderVersion))));
|
||||
Collections.singletonList(getLaunchMetaUrl(metaGameVersion, loaderVersion))));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
lock.writeLock().unlock();
|
||||
}
|
||||
@@ -71,6 +74,12 @@ public final class LegacyFabricVersionList extends VersionList<LegacyFabricRemot
|
||||
.stream().map(GameVersion::getVersion).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static String normalizeVersion(String version) {
|
||||
return version.startsWith("2point0_")
|
||||
? "2.0_" + version.substring("2point0_".length())
|
||||
: version;
|
||||
}
|
||||
|
||||
private static String getLaunchMetaUrl(String gameVersion, String loaderVersion) {
|
||||
return String.format("https://meta.legacyfabric.net/v2/versions/loader/%s/%s", gameVersion, loaderVersion);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user