Interface MinecraftExtension

All Superinterfaces:
MinecraftMappingsContainer
All Known Subinterfaces:
MinecraftExtensionForProject<T>, MinecraftExtensionForProjectWithAccessTransformers

public interface MinecraftExtension extends MinecraftMappingsContainer

The main extension for ForgeGradle, where the Minecraft dependency resolution takes place.

Restrictions

  • When declaring Minecraft dependencies, only module dependencies are supported.
    • The resulting Minecraft dependency is created by the Minecraft Mavenizer. It is not merely a dependency transformation, which means that it cannot use file and project dependencies to generate the Minecraft artifacts.
    • Attempting to provide a non-module dependency to MinecraftExtensionForProject.dependency(Object), will cause the build to fail.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    This interface contains the attributes used by the Minecraft extension for resolving the Minecraft and deobfuscated dependencies.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name for this extension in Gradle.
  • Method Summary

    Modifier and Type
    Method
    Description
    The attributes object for easy reference.
    org.gradle.api.Action<org.gradle.api.artifacts.repositories.MavenArtifactRepository>
    A closure for the generated Minecraft maven to be passed into RepositoryHandler.maven(Closure).
    default org.gradle.api.artifacts.repositories.MavenArtifactRepository
    mavenizer(org.gradle.api.artifacts.dsl.RepositoryHandler repositories)
    Adds the generated Minecraft maven to the given repository handler.

    Methods inherited from interface net.minecraftforge.gradle.MinecraftMappingsContainer

    getMappings, mappings, mappings
  • Field Details

  • Method Details

    • getMavenizer

      org.gradle.api.Action<org.gradle.api.artifacts.repositories.MavenArtifactRepository> getMavenizer()
      A closure for the generated Minecraft maven to be passed into RepositoryHandler.maven(Closure).

      Declaring this in your buildscript is required for the Minecraft dependencies to resolve properly.

      
       repositories {
           maven minecraft.maven
       }
       
      Returns:
      The closure
    • mavenizer

      default org.gradle.api.artifacts.repositories.MavenArtifactRepository mavenizer(org.gradle.api.artifacts.dsl.RepositoryHandler repositories)
      Adds the generated Minecraft maven to the given repository handler.
      
       minecraft.maven(repositories)
       
      Parameters:
      repositories - The repository handler to add the maven to
      Returns:
      The Minecraft maven
      See Also:
    • getAttributes

      The attributes object for easy reference.
      
       dependencies {
           implementation 'com.example:example:1.0' {
               attributes.attribute(minecraft.attributes.os, 'windows')
           }
       }
       
      Returns:
      The attributes object
      See Also: