fix: prefer self-hosted mirror for game metadata, libraries, forge and assets
BMCLAPI 302-redirects to CDNs (sakura.sld.tw, cernet) that are TLS-blocked on many mainland networks, leaving the official origins as the only fallback and stalling launches at the 1.7.10 asset index with 0 B/s. The VPS now hosts the pack's full dependency set; try it first with BMCLAPI as fallback.
This commit is contained in:
1 parent
040dceb9ed
commit
5ca7bcaad0
1 file changed
+19
-5
@@ -133,6 +133,13 @@ public final class HMCLDownloadProvider extends DownloadProvider {
|
||||
public HMCLDownloadProvider(Supplier<@Unmodifiable List<String>> mirrorRoots) {
|
||||
this.mirrorRoots = Objects.requireNonNull(mirrorRoots);
|
||||
this.rules = List.of(
|
||||
// The self-hosted client mirror carries the pack's full dependency set. BMCLAPI's
|
||||
// redirect CDNs (sakura.sld.tw, cernet) and the Mojang/Forge origins are TLS-blocked
|
||||
// on many mainland networks, so the VPS must be tried before any of them.
|
||||
new SimpleRule("https://piston-meta.mojang.com", Metadata.getClientFileApi() + "/piston-meta", "https://bmclapi2.bangbang93.com"),
|
||||
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"),
|
||||
new MultiRootRule("https://bmclapi2.bangbang93.com", Function.identity()),
|
||||
new MultiRootRule("https://bmclapi.bangbang93.com", Function.identity()),
|
||||
new MultiRootRule("https://launchermeta.mojang.com", Function.identity()),
|
||||
@@ -301,11 +308,18 @@ public final class HMCLDownloadProvider extends DownloadProvider {
|
||||
@Override
|
||||
public DownloadCandidates getAssetObjectCandidates(AssetObject assetObject) {
|
||||
String location = assetObject.getLocation();
|
||||
return getCandidates(
|
||||
fileSource,
|
||||
WebURL.parse("https://resources.download.minecraft.net/" + location),
|
||||
mirrorUrls("/assets/" + location)
|
||||
);
|
||||
WebURL officialUrl = WebURL.parse("https://resources.download.minecraft.net/" + location);
|
||||
List<WebURL> mirrors = mirrorUrls("/assets/" + location);
|
||||
if (preferMirror(fileSource)) {
|
||||
// Keep the VPS strictly first: spreadPrimary would otherwise rotate BMCLAPI ahead of
|
||||
// it, and BMCLAPI's asset CDN is unreachable on blocked networks (per-file timeouts).
|
||||
var candidates = new ArrayList<DownloadCandidate>(mirrors.size() + 2);
|
||||
candidates.add(DownloadCandidate.of(WebURL.parse(Metadata.getClientFileApi() + "/assets/" + location)));
|
||||
candidates.addAll(spreadPrimary(mirrors.stream().map(DownloadCandidate::of).toList(), officialUrl.href()));
|
||||
candidates.add(DownloadCandidate.of(officialUrl));
|
||||
return DownloadCandidates.of(List.copyOf(candidates));
|
||||
}
|
||||
return getCandidates(fileSource, officialUrl, mirrors);
|
||||
}
|
||||
|
||||
@NotNullByDefault
|
||||
|
||||
Reference in new issue
Block a user