diff --git a/src/main/java/net/fabricmc/loom/LoomGradleExtension.java b/src/main/java/net/fabricmc/loom/LoomGradleExtension.java index e9624aa..060a094 100644 --- a/src/main/java/net/fabricmc/loom/LoomGradleExtension.java +++ b/src/main/java/net/fabricmc/loom/LoomGradleExtension.java @@ -99,8 +99,7 @@ public interface LoomGradleExtension extends LoomGradleExtensionAPI { } default String getIntermediaryUrl(String minecraftVersion) { - // TODO reimplement a way to change this, was never really supported api anyway - return String.format("https://maven.fabricmc.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar", minecraftVersion); + return String.format(this.getIntermediaryUrl().get(), minecraftVersion); } @Override diff --git a/src/main/java/net/fabricmc/loom/api/LoomGradleExtensionAPI.java b/src/main/java/net/fabricmc/loom/api/LoomGradleExtensionAPI.java index 4020ecd..2fd4627 100644 --- a/src/main/java/net/fabricmc/loom/api/LoomGradleExtensionAPI.java +++ b/src/main/java/net/fabricmc/loom/api/LoomGradleExtensionAPI.java @@ -211,4 +211,11 @@ public interface LoomGradleExtensionAPI { * @return the property controlling the transitive access wideners */ Property getEnableTransitiveAccessWideners(); + + /** + * Use "%1$s" as a placeholder for the minecraft version. + * + * @return the intermediary url template + */ + Property getIntermediaryUrl(); } diff --git a/src/main/java/net/fabricmc/loom/extension/LoomGradleExtensionApiImpl.java b/src/main/java/net/fabricmc/loom/extension/LoomGradleExtensionApiImpl.java index 4e7c9f3..f833e52 100644 --- a/src/main/java/net/fabricmc/loom/extension/LoomGradleExtensionApiImpl.java +++ b/src/main/java/net/fabricmc/loom/extension/LoomGradleExtensionApiImpl.java @@ -61,6 +61,7 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA protected final Property customManifest; protected final Property setupRemappedVariants; protected final Property transitiveAccessWideners; + protected final Property intermediary; private final ModVersionParser versionParser; @@ -85,6 +86,8 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA this.transitiveAccessWideners = project.getObjects().property(Boolean.class) .convention(true); this.transitiveAccessWideners.finalizeValueOnRead(); + this.intermediary = project.getObjects().property(String.class) + .convention("https://maven.fabricmc.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar"); this.versionParser = new ModVersionParser(project); @@ -173,6 +176,11 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA protected abstract LoomFiles getFiles(); + @Override + public Property getIntermediaryUrl() { + return intermediary; + } + @Override public void disableDeprecatedPomGeneration(MavenPublication publication) { net.fabricmc.loom.configuration.MavenPublication.excludePublication(publication); diff --git a/src/main/java/net/fabricmc/loom/extension/MinecraftGradleExtension.java b/src/main/java/net/fabricmc/loom/extension/MinecraftGradleExtension.java index 4d1e395..4ffea87 100644 --- a/src/main/java/net/fabricmc/loom/extension/MinecraftGradleExtension.java +++ b/src/main/java/net/fabricmc/loom/extension/MinecraftGradleExtension.java @@ -156,4 +156,10 @@ public class MinecraftGradleExtension implements LoomGradleExtensionAPI { reportDeprecation(); throw new UnsupportedOperationException(); } + + @Override + public Property getIntermediaryUrl() { + reportDeprecation(); + return parent.getIntermediaryUrl(); + } }