From bb68465a8d4205edc378a9f373334849e87cc075 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Thu, 26 Mar 2020 19:40:00 +0000 Subject: [PATCH] Add a basic way to specify custom intermediary URLs, ideally this would use maven. But thats more work than I can be bothered to do. --- src/main/java/net/fabricmc/loom/LoomGradleExtension.java | 7 +++++++ .../java/net/fabricmc/loom/providers/MappingsProvider.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/fabricmc/loom/LoomGradleExtension.java b/src/main/java/net/fabricmc/loom/LoomGradleExtension.java index a867380..3fe00fe 100644 --- a/src/main/java/net/fabricmc/loom/LoomGradleExtension.java +++ b/src/main/java/net/fabricmc/loom/LoomGradleExtension.java @@ -60,6 +60,7 @@ public class LoomGradleExtension { public boolean extractJars = false; public String customManifest = null; public File accessWidener = null; + public Function intermediaryUrl = mcVer -> "https://maven.fabricmc.net/net/fabricmc/intermediary/" + mcVer + "/intermediary-" + mcVer + "-v2.jar"; private List unmappedModsBuilt = new ArrayList<>(); @@ -317,4 +318,10 @@ public class LoomGradleExtension { public boolean ideSync() { return Boolean.parseBoolean(System.getProperty("idea.sync.active", "false")); } + + // Ideally this should use maven, but this is a lot easier + public Function getIntermediaryUrl() { + //Done like this to work around this possibly not being a java string... + return s -> intermediaryUrl.apply(s).toString(); + } } diff --git a/src/main/java/net/fabricmc/loom/providers/MappingsProvider.java b/src/main/java/net/fabricmc/loom/providers/MappingsProvider.java index 887f3f7..e466b2c 100644 --- a/src/main/java/net/fabricmc/loom/providers/MappingsProvider.java +++ b/src/main/java/net/fabricmc/loom/providers/MappingsProvider.java @@ -151,7 +151,7 @@ public class MappingsProvider extends DependencyProvider { // Download and extract intermediary String encodedMinecraftVersion = UrlEscapers.urlFragmentEscaper().escape(minecraftVersion); - String intermediaryArtifactUrl = "https://maven.fabricmc.net/net/fabricmc/intermediary/" + encodedMinecraftVersion + "/intermediary-" + encodedMinecraftVersion + "-v2.jar"; + String intermediaryArtifactUrl = getExtension().getIntermediaryUrl().apply(encodedMinecraftVersion); Path intermediaryJar = mappingsStepsDir.resolve("v2-intermediary-" + minecraftVersion + ".jar"); DownloadUtil.downloadIfChanged(new URL(intermediaryArtifactUrl), intermediaryJar.toFile(), project.getLogger());