From 34c24cde3cfa99e1cd808263a5c332e44ad738d6 Mon Sep 17 00:00:00 2001 From: Juuz <6596629+Juuxel@users.noreply.github.com> Date: Fri, 9 Dec 2022 10:50:21 +0200 Subject: [PATCH] Add ModSettings.sourceSet overloads taking source set names (#765) Closes #764. Also fixes some minor stuff in the javadocs of sourceSet(). --- .../net/fabricmc/loom/api/ModSettings.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/fabricmc/loom/api/ModSettings.java b/src/main/java/net/fabricmc/loom/api/ModSettings.java index 45d246be..03cdb070 100644 --- a/src/main/java/net/fabricmc/loom/api/ModSettings.java +++ b/src/main/java/net/fabricmc/loom/api/ModSettings.java @@ -54,7 +54,7 @@ public abstract class ModSettings implements Named { } /** - * Add {@link SourceSet}'s output directories from the current project to be grouped with the named mod. + * Add {@link SourceSet}'s output directories from the current project to be grouped with the named mod. */ public void sourceSet(SourceSet sourceSet) { Project project = getProject(); @@ -72,12 +72,30 @@ public abstract class ModSettings implements Named { } /** - * Add {@link SourceSet}'s output directories from supplied project to be grouped with the named mod. + * Add {@link SourceSet}'s output directories from the current project to be grouped with the named mod. + * + * @param name the name of the source set + */ + public void sourceSet(String name) { + sourceSet(name, getProject()); + } + + /** + * Add {@link SourceSet}'s output directories from the supplied project to be grouped with the named mod. */ public void sourceSet(SourceSet sourceSet, Project project) { getModSourceSets().add(new SourceSetReference(sourceSet, project)); } + /** + * Add {@link SourceSet}'s output directories from the supplied project to be grouped with the named mod. + * + * @param name the name of the source set + */ + public void sourceSet(String name, Project project) { + sourceSet(SourceSetHelper.getSourceSetByName(name, project), project); + } + /** * Add a number of {@link Dependency} to the mod's classpath group. Should be used to include all dependencies that are shaded into your mod. *