fix: fetch the Forge version list and installer from the client mirror first #25

Merged
layue13 merged 1 commits from fix/forge-list-from-client-mirror into main 2026-11-19 04:55:54 +00:00
@@ -140,6 +140,9 @@ public final class HMCLDownloadProvider extends DownloadProvider {
new SimpleRule("https://libraries.minecraft.net", Metadata.getClientFileApi() + "/libraries", "https://bmclapi2.bangbang93.com/libraries"),
new SimpleRule("https://maven.minecraftforge.net", Metadata.getClientFileApi() + "/forge-maven", "https://bmclapi2.bangbang93.com/maven"),
new SimpleRule("https://launcher.mojang.com", Metadata.getClientFileApi() + "/launcher-mojang", "https://bmclapi2.bangbang93.com"),
// Forge 1.7.10 installer URLs from the version list point at files.minecraftforge.net.
new SimpleRule("https://files.minecraftforge.net/maven", Metadata.getClientFileApi() + "/forge-maven", "https://bmclapi2.bangbang93.com/maven"),
new SimpleRule("http://files.minecraftforge.net/maven", Metadata.getClientFileApi() + "/forge-maven", "https://bmclapi2.bangbang93.com/maven"),
new MultiRootRule("https://bmclapi2.bangbang93.com", Function.identity()),
new MultiRootRule("https://bmclapi.bangbang93.com", Function.identity()),
new MultiRootRule("https://launchermeta.mojang.com", Function.identity()),
@@ -230,7 +233,11 @@ public final class HMCLDownloadProvider extends DownloadProvider {
Task<ComponentRemoteVersionList<ForgeRemoteVersion>> fetchBMCL = ForgeRemoteVersion.fetchBMCLAsync(this, bmclRoot, gameVersion);
if (preferMirror(source)) {
return new FallbackTask<>(fetchBMCL, fetchOfficial);
// The client mirror serves the pack's Forge version list in BMCLAPI's format
// (<fileApi>/forge/minecraft/<mc>); BMCLAPI itself is unreachable on many mainland networks.
Task<ComponentRemoteVersionList<ForgeRemoteVersion>> fetchClientMirror =
ForgeRemoteVersion.fetchBMCLAsync(this, Metadata.getClientFileApi(), gameVersion);
return new FallbackTask<>(fetchClientMirror, new FallbackTask<>(fetchBMCL, fetchOfficial));
} else {
return new FallbackTask<>(fetchOfficial, fetchBMCL);
}