Interface LoomGradleExtensionAPI

All Known Subinterfaces:
LoomGradleExtension
All Known Implementing Classes:
LoomGradleExtensionApiImpl, LoomGradleExtensionImpl

public interface LoomGradleExtensionAPI
This is the public api available exposed to build scripts.
  • Method Details

    • getDeprecationHelper

      @Internal DeprecationHelper getDeprecationHelper()
    • getAccessWidenerPath

      org.gradle.api.file.RegularFileProperty getAccessWidenerPath()
    • getFabricModJsonPath

      org.gradle.api.file.RegularFileProperty getFabricModJsonPath()
      Specifies the fabric.mod.json file location used in injected interface processing.

      By default, either src/main/resources/fabric.mod.json or src/client/resources/fabric.mod.json in 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 org.gradle.api.provider.ListProperty<JarProcessor> getGameJarProcessors()
      Deprecated.
    • addJarProcessor

      @Deprecated default void addJarProcessor(JarProcessor processor)
      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

      default org.gradle.api.NamedDomainObjectContainer<RunConfigSettings> getRuns()
      Returns:
      the value of getRunConfigs()
    • mixin

      void mixin(org.gradle.api.Action<MixinExtensionAPI> action)
    • mods

      void mods(org.gradle.api.Action<org.gradle.api.NamedDomainObjectContainer<ModSettings>> action)
      Optionally register and configure a ModSettings object. 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

      default List<RemapConfigurationSettings> getCompileRemapConfigurations()
    • getRuntimeRemapConfigurations

      default List<RemapConfigurationSettings> getRuntimeRemapConfigurations()
    • getMixin

      @Experimental MixinExtensionAPI getMixin()
    • interfaceInjection

      default void interfaceInjection(org.gradle.api.Action<InterfaceInjectionExtensionAPI> action)
    • getInterfaceInjection

      InterfaceInjectionExtensionAPI getInterfaceInjection()
    • versionsManifests

      @Experimental default void versionsManifests(org.gradle.api.Action<VersionsManifestsAPI> action)
    • getVersionsManifests

      @Experimental ManifestLocations getVersionsManifests()
    • getCustomMinecraftManifest

      @Deprecated default org.gradle.api.provider.Property<String> getCustomMinecraftManifest()
      Deprecated.
    • 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

      @Experimental IntermediateMappingsProvider 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

      GenerateSourcesTask getDecompileTask(DecompilerOptions options, boolean client)
      Returns the GenerateSourcesTask for the given DecompilerOptions. 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
    • 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 JSR Nullable, Nonnull, and Immutable annotations to their JetBrains counterparts in the Minecraft JAR.

      When disabled, Loom keeps JSR annotations as-is, and remaps any JetBrains Nullable, NotNull, and Unmodifiable annotations 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 FileCollection containing 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 a FileCollection into 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 include configuration. 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 in
      configuration - 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 in
      configuration - 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

      void setGenerateSrgTiny(Boolean generateSrgTiny)
    • shouldGenerateSrgTiny

      boolean shouldGenerateSrgTiny()
    • addTaskBeforeRun

      @Deprecated default void addTaskBeforeRun(String task)
      Deprecated.
      Unsupported.
    • getTasksBeforeRun

      @Deprecated List<String> getTasksBeforeRun()
      Deprecated.
      Unsupported.
    • getSettingsPostEdit

      @Internal List<Consumer<RunConfiguration>> 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

      void forge(org.gradle.api.Action<ForgeExtensionAPI> action)
    • 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

      void neoForge(org.gradle.api.Action<NeoForgeExtensionAPI> action)
    • 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 RemapJarTask so 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 RemapJarTask so that the access widener gets remapped properly.

      This method only works in Fabric and Quilt mods.

      Parameters:
      jarTask - the task to inject to
      accessWidenerFile - the access widener file, resolved as per Project.file(Object)
      See Also: