Interface LoomGradleExtensionAPI
- All Known Subinterfaces:
LoomGradleExtension
- All Known Implementing Classes:
LoomGradleExtensionApiImpl,LoomGradleExtensionImpl
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddJarProcessor(JarProcessor processor) Deprecated.voidaddMinecraftJarProcessor(Class<? extends MinecraftJarProcessor<?>> clazz, Object... parameters) addRemapConfiguration(String name, org.gradle.api.Action<RemapConfigurationSettings> action) <T extends RemapperParameters>
voidaddRemapperExtension(Class<? extends RemapperExtension<T>> remapperExtensionClass, Class<T> parametersClass, org.gradle.api.Action<T> parameterAction) default voidaddTaskBeforeRun(String task) Deprecated.Unsupported.booleandefault voidvoidcreateRemapConfigurations(org.gradle.api.tasks.SourceSet sourceSet) voiddecompilers(org.gradle.api.Action<org.gradle.api.NamedDomainObjectContainer<DecompilerOptions>> action) voiddisableDeprecatedPomGeneration(org.gradle.api.publish.maven.MavenPublication publication) Disables the deprecated POM generation for a publication.voidforge(org.gradle.api.Action<ForgeExtensionAPI> action) org.gradle.api.file.RegularFilePropertydefault List<RemapConfigurationSettings> default org.gradle.api.provider.Property<String> Deprecated.use getCustomMinecraftMetadata() insteadorg.gradle.api.provider.Property<String> org.gradle.api.NamedDomainObjectContainer<DecompilerOptions> getDecompileTask(DecompilerOptions options, boolean client) Returns theGenerateSourcesTaskfor the givenDecompilerOptions.org.gradle.api.provider.Property<String> org.gradle.api.provider.Property<Boolean> When true loom will apply mod provided javadoc from dependencies.org.gradle.api.provider.Property<Boolean> When true loom will apply transitive access wideners from compile dependencies.org.gradle.api.file.RegularFilePropertySpecifies thefabric.mod.jsonfile location used in injected interface processing.getForge()Gets the Forge extension used to configure Forge details.org.gradle.api.provider.ListProperty<JarProcessor> Deprecated.org.gradle.api.provider.Property<String> Use "%1$s" as a placeholder for the minecraft version.org.gradle.api.provider.SetProperty<String> org.gradle.api.file.ConfigurableFileCollectionReturns the tiny mappings file used to remap the game and mods.org.gradle.api.provider.Property<MinecraftJarConfiguration<?, ?, ?>> org.gradle.api.provider.ListProperty<MinecraftJarProcessor<?>> org.gradle.api.provider.Provider<String> getMixin()org.gradle.api.NamedDomainObjectContainer<ModSettings> getMods()Reads the mod version from the fabric.mod.json file located in the main sourcesets resources.org.gradle.api.file.FileCollectionGets the NeoForge extension used to configure NeoForge details.org.gradle.api.provider.Provider<ModPlatform> org.gradle.api.provider.Property<String> Returns the production namespace — the intermediary-like namespace that the processed Minecraft jar and mod dependencies are in before being remapped to named.org.gradle.api.NamedDomainObjectList<RemapConfigurationSettings> org.gradle.api.provider.Property<Boolean> When enabled, Loom remaps JSRNullable,Nonnull, andImmutableannotations to their JetBrains counterparts in the Minecraft JAR.org.gradle.api.NamedDomainObjectContainer<RunConfigSettings> default org.gradle.api.NamedDomainObjectContainer<RunConfigSettings> getRuns()Returns the value ofgetRunConfigs().org.gradle.api.provider.Property<Boolean> org.gradle.api.provider.Property<Boolean> When enabled, lwjgl-opengl or lwjgl-vulkan will be added as a runtime dependency preventing the mod from compiling against a specific graphics API.default List<RemapConfigurationSettings> org.gradle.api.provider.Property<Boolean> Deprecated.Unsupported.org.gradle.api.provider.Property<Boolean> Whether to transform zip entries within nested jars to be using STORED compression.org.gradle.api.provider.Property<Boolean> default voidinjectAccessWidener(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask) Injects the project access widener or class tweaker file into the specified jar and adds it to the mod metadata file.voidinjectAccessWidener(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, Object accessWidenerFile) Injects an access widener or class tweaker file into the specified jar and adds it to the mod metadata file.default voidinterfaceInjection(org.gradle.api.Action<InterfaceInjectionExtensionAPI> action) default booleanisForge()default booleandefault booleandefault booleanisQuilt()booleanorg.gradle.api.artifacts.Dependencylayered(org.gradle.api.Action<LayeredMappingSpecBuilder> action) voidmixin(org.gradle.api.Action<MixinExtensionAPI> action) voidmods(org.gradle.api.Action<org.gradle.api.NamedDomainObjectContainer<ModSettings>> action) Optionally register and configure aModSettingsobject.voidneoForge(org.gradle.api.Action<NeoForgeExtensionAPI> action) voidnestJars(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, org.gradle.api.artifacts.Configuration configuration) Includes dependencies from a configuration in the specified jar task.voidnestJars(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, org.gradle.api.file.FileCollection jars) Nest mod jars from aFileCollectioninto the specified jar task.voidnestJars(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, org.gradle.api.NamedDomainObjectProvider<? extends org.gradle.api.artifacts.Configuration> configuration) Includes dependencies from a lazily provided configuration in the specified jar task.default voidAn Experimental option to provide empty intermediate mappings, to be used for game versions without any intermediate mappings.org.gradle.api.artifacts.Dependencyvoidruns(org.gradle.api.Action<org.gradle.api.NamedDomainObjectContainer<RunConfigSettings>> action) default voidvoidsetGenerateSrgTiny(Boolean generateSrgTiny) <T extends IntermediateMappingsProvider>
voidsetIntermediateMappingsProvider(Class<T> clazz, org.gradle.api.Action<T> action) voidsetIntermediateMappingsProvider(IntermediateMappingsProvider intermediateMappingsProvider) booleanvoidvoiddefault voiddefault voidversionsManifests(org.gradle.api.Action<VersionsManifestsAPI> action)
-
Method Details
-
getDeprecationHelper
-
getAccessWidenerPath
org.gradle.api.file.RegularFileProperty getAccessWidenerPath() -
getFabricModJsonPath
org.gradle.api.file.RegularFileProperty getFabricModJsonPath()Specifies thefabric.mod.jsonfile location used in injected interface processing.By default, either
src/main/resources/fabric.mod.jsonorsrc/client/resources/fabric.mod.jsonin the project directory is used.Providing a path to a different location allows using a shared or preprocessed file. However, at the end it must be put into the root of the processed resources directory (usually
build/resources/main). -
getDecompilerOptions
org.gradle.api.NamedDomainObjectContainer<DecompilerOptions> getDecompilerOptions() -
decompilers
void decompilers(org.gradle.api.Action<org.gradle.api.NamedDomainObjectContainer<DecompilerOptions>> action) -
getGameJarProcessors
Deprecated. -
addJarProcessor
Deprecated. -
getMinecraftJarProcessors
org.gradle.api.provider.ListProperty<MinecraftJarProcessor<?>> getMinecraftJarProcessors() -
addMinecraftJarProcessor
void addMinecraftJarProcessor(Class<? extends MinecraftJarProcessor<?>> clazz, Object... parameters) -
getLog4jConfigs
org.gradle.api.file.ConfigurableFileCollection getLog4jConfigs() -
officialMojangMappings
org.gradle.api.artifacts.Dependency officialMojangMappings() -
layered
org.gradle.api.artifacts.Dependency layered(org.gradle.api.Action<LayeredMappingSpecBuilder> action) -
runs
void runs(org.gradle.api.Action<org.gradle.api.NamedDomainObjectContainer<RunConfigSettings>> action) -
getRunConfigs
org.gradle.api.NamedDomainObjectContainer<RunConfigSettings> getRunConfigs() -
getRuns
Returns the value ofgetRunConfigs(). This is an alias for it that matchesruns(org.gradle.api.Action<org.gradle.api.NamedDomainObjectContainer<net.fabricmc.loom.configuration.ide.RunConfigSettings>>).- Returns:
- the value of
getRunConfigs()
-
mixin
-
mods
Optionally register and configure aModSettingsobject. The name should match the modid. This is generally only required when the mod spans across multiple classpath directories, such as when using split sourcesets. -
getMods
org.gradle.api.NamedDomainObjectContainer<ModSettings> getMods() -
getRemapConfigurations
org.gradle.api.NamedDomainObjectList<RemapConfigurationSettings> getRemapConfigurations() -
addRemapConfiguration
RemapConfigurationSettings addRemapConfiguration(String name, org.gradle.api.Action<RemapConfigurationSettings> action) -
createRemapConfigurations
void createRemapConfigurations(org.gradle.api.tasks.SourceSet sourceSet) -
getCompileRemapConfigurations
-
getRuntimeRemapConfigurations
-
getMixin
-
interfaceInjection
-
getInterfaceInjection
InterfaceInjectionExtensionAPI getInterfaceInjection() -
versionsManifests
-
getVersionsManifests
-
getCustomMinecraftManifest
Deprecated.use getCustomMinecraftMetadata() instead -
getCustomMinecraftMetadata
org.gradle.api.provider.Property<String> getCustomMinecraftMetadata() -
getKnownIndyBsms
org.gradle.api.provider.SetProperty<String> getKnownIndyBsms() -
disableDeprecatedPomGeneration
@Experimental void disableDeprecatedPomGeneration(org.gradle.api.publish.maven.MavenPublication publication) Disables the deprecated POM generation for a publication. This is useful if you want to suppress deprecation warnings when you're not using software components.Experimental API: Will be removed in Loom 0.12 together with the deprecated POM generation functionality.
- Parameters:
publication- the maven publication
-
getModVersion
String getModVersion()Reads the mod version from the fabric.mod.json file located in the main sourcesets resources. This is useful if you want to set the gradle version based of the version in the fabric.mod.json file.- Returns:
- the version defined in the fabric.mod.json
-
getEnableTransitiveAccessWideners
org.gradle.api.provider.Property<Boolean> getEnableTransitiveAccessWideners()When true loom will apply transitive access wideners from compile dependencies.- Returns:
- the property controlling the transitive access wideners
-
getEnableModProvidedJavadoc
org.gradle.api.provider.Property<Boolean> getEnableModProvidedJavadoc()When true loom will apply mod provided javadoc from dependencies.- Returns:
- the property controlling the mod provided javadoc
-
getIntermediateMappingsProvider
-
setIntermediateMappingsProvider
@Experimental void setIntermediateMappingsProvider(IntermediateMappingsProvider intermediateMappingsProvider) -
setIntermediateMappingsProvider
@Experimental <T extends IntermediateMappingsProvider> void setIntermediateMappingsProvider(Class<T> clazz, org.gradle.api.Action<T> action) -
noIntermediateMappings
@Experimental default void noIntermediateMappings()An Experimental option to provide empty intermediate mappings, to be used for game versions without any intermediate mappings. -
getMappingsFile
File getMappingsFile()Returns the tiny mappings file used to remap the game and mods.- Returns:
- the mappings file, or null if in a non-obfuscated environment
-
getDecompileTask
Returns theGenerateSourcesTaskfor the givenDecompilerOptions. When env source sets are split and the client param is true the decompile task for the client jar will be returned. -
getIntermediaryUrl
org.gradle.api.provider.Property<String> getIntermediaryUrl()Use "%1$s" as a placeholder for the minecraft version.- Returns:
- the intermediary url template
-
getProductionNamespace
org.gradle.api.provider.Property<String> getProductionNamespace()Returns the production namespace — the intermediary-like namespace that the processed Minecraft jar and mod dependencies are in before being remapped to named.This serves as the source namespace for all remapping operations on both the Minecraft jar (access wideners, interface injection, javadoc) and mod dependencies.
Values:
- Fabric/Quilt (normal versions):
intermediary - Forge (before 1.20.6):
srg - NeoForge and Forge (1.20.6+):
mojang - All platforms (unobfuscated 1.21.11+):
official
- Returns:
- the production namespace property
- Fabric/Quilt (normal versions):
-
getUseIntermediateMappings
org.gradle.api.provider.Property<Boolean> getUseIntermediateMappings()- Returns:
- whether to use intermediate mappings
-
getDefaultMixinRemapType
org.gradle.api.provider.Property<String> getDefaultMixinRemapType()- Returns:
- the default mixin remap type
-
getMinecraftJarConfiguration
@Experimental org.gradle.api.provider.Property<MinecraftJarConfiguration<?,?, getMinecraftJarConfiguration()?>> -
serverOnlyMinecraftJar
default void serverOnlyMinecraftJar() -
clientOnlyMinecraftJar
default void clientOnlyMinecraftJar() -
splitMinecraftJar
default void splitMinecraftJar() -
splitEnvironmentSourceSets
void splitEnvironmentSourceSets() -
areEnvironmentSourceSetsSplit
boolean areEnvironmentSourceSetsSplit() -
getRemapJsrAnnotationsToJetBrains
org.gradle.api.provider.Property<Boolean> getRemapJsrAnnotationsToJetBrains()When enabled, Loom remaps JSRNullable,Nonnull, andImmutableannotations to their JetBrains counterparts in the Minecraft JAR.When disabled, Loom keeps JSR annotations as-is, and remaps any JetBrains
Nullable,NotNull, andUnmodifiableannotations to their JSR counterparts in the Minecraft JAR.This has no effect on Minecraft versions that solely use JSpecify annotations.
Default: true
- Returns:
- the property controlling the remapping of JSR annotations
-
getRuntimeOnlyLog4j
org.gradle.api.provider.Property<Boolean> getRuntimeOnlyLog4j() -
getRuntimeOnlyLwjglGraphics
org.gradle.api.provider.Property<Boolean> getRuntimeOnlyLwjglGraphics()When enabled, lwjgl-opengl or lwjgl-vulkan will be added as a runtime dependency preventing the mod from compiling against a specific graphics API. -
getSplitModDependencies
org.gradle.api.provider.Property<Boolean> getSplitModDependencies() -
getUncompressNestedJars
org.gradle.api.provider.Property<Boolean> getUncompressNestedJars()Whether to transform zip entries within nested jars to be using STORED compression.This will usually reduce the resulting jar size by avoiding double-compression.
However, this will very likely increase the decompressed size during runtime as a side effect.
Default: false
- Returns:
- the property controlling this toggle
-
addRemapperExtension
<T extends RemapperParameters> void addRemapperExtension(Class<? extends RemapperExtension<T>> remapperExtensionClass, Class<T> parametersClass, org.gradle.api.Action<T> parameterAction) -
getMinecraftVersion
org.gradle.api.provider.Provider<String> getMinecraftVersion()- Returns:
- The minecraft version, as a
Provider.
-
getNamedMinecraftJars
org.gradle.api.file.FileCollection getNamedMinecraftJars()- Returns:
- A lazily evaluated
FileCollectioncontaining the named minecraft jars.
-
nestJars
@Experimental void nestJars(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, org.gradle.api.file.FileCollection jars) Nest mod jars from aFileCollectioninto the specified jar task. This is useful for including locally built mod jars or jars that don't come from Maven.Important: The jars must already be valid mod jars (containing a fabric.mod.json file). Non-mod jars will be rejected.
Example usage:
loom { nestJars(tasks.jar, files('local-mod.jar')) nestJars(tasks.remapJar, tasks.named('buildOtherMod')) }- Parameters:
jarTask- the jar task to nest jars into (can be jar or remapJar)jars- the file collection containing mod jars to nest- Since:
- 1.14
-
nestJars
@Experimental void nestJars(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, org.gradle.api.artifacts.Configuration configuration) Includes dependencies from a configuration in the specified jar task.This is the task-bound equivalent of the default
includeconfiguration. Dependencies are converted to nestable jars before they are nested into the jar task.Example usage:
loom { nestJars(tasks.jar, configurations.myInclude) nestJars(tasks.named('remapJar'), configurations.named('myRemapInclude')) }- Parameters:
jarTask- the jar task to include dependencies inconfiguration- the configuration containing dependencies to include- Since:
- 1.17
-
nestJars
@Experimental void nestJars(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, org.gradle.api.NamedDomainObjectProvider<? extends org.gradle.api.artifacts.Configuration> configuration) Includes dependencies from a lazily provided configuration in the specified jar task.- Parameters:
jarTask- the jar task to include dependencies inconfiguration- the lazy configuration containing dependencies to include- Since:
- 1.17
-
silentMojangMappingsLicense
void silentMojangMappingsLicense() -
isSilentMojangMappingsLicenseEnabled
boolean isSilentMojangMappingsLicenseEnabled() -
getPlatform
org.gradle.api.provider.Provider<ModPlatform> getPlatform() -
isForgeLike
default boolean isForgeLike() -
isForge
default boolean isForge() -
isNeoForge
default boolean isNeoForge() -
isQuilt
default boolean isQuilt() -
setGenerateSrgTiny
-
shouldGenerateSrgTiny
boolean shouldGenerateSrgTiny() -
addTaskBeforeRun
Deprecated.Unsupported. -
getTasksBeforeRun
Deprecated.Unsupported. -
getSettingsPostEdit
-
getForge
ForgeExtensionAPI getForge()Gets the Forge extension used to configure Forge details.- Returns:
- the Forge extension
- Throws:
UnsupportedOperationException- if running on another platform- See Also:
-
forge
-
getNeoForge
NeoForgeExtensionAPI getNeoForge()Gets the NeoForge extension used to configure NeoForge details.- Returns:
- the NeoForge extension
- Throws:
UnsupportedOperationException- if running on another platform- See Also:
-
neoForge
-
injectAccessWidener
@Experimental default void injectAccessWidener(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask) Injects the project access widener or class tweaker file into the specified jar and adds it to the mod metadata file.Only the access widener file name is considered; it will be placed top-level in the mod jar.
Only one injected access widener or class tweaker is supported per jar task. When using this API with obfuscated Minecraft versions, the target task must be a
RemapJarTaskso that the access widener gets remapped properly.This method only works in Fabric and Quilt mods.
Code example:
loom.injectAccessWidener(tasks.named('jar'))- Parameters:
jarTask- the task to inject to- See Also:
-
injectAccessWidener
@Experimental void injectAccessWidener(org.gradle.api.tasks.TaskProvider<? extends org.gradle.jvm.tasks.Jar> jarTask, Object accessWidenerFile) Injects an access widener or class tweaker file into the specified jar and adds it to the mod metadata file.Only the access widener file name is considered; it will be placed top-level in the mod jar.
Only one injected access widener or class tweaker is supported per jar task. When using this API with obfuscated Minecraft versions, the target task must be a
RemapJarTaskso that the access widener gets remapped properly.This method only works in Fabric and Quilt mods.
- Parameters:
jarTask- the task to inject toaccessWidenerFile- the access widener file, resolved as perProject.file(Object)- See Also:
-