Class FabricModJsonV1Spec

java.lang.Object
net.fabricmc.loom.api.fmj.FabricModJsonV1Spec

public abstract class FabricModJsonV1Spec extends Object
Represents the Fabric mod JSON v1 specification.

This class defines properties of a Fabric mod JSON file via a type-safe DSL.

  • Constructor Details

    • FabricModJsonV1Spec

      public FabricModJsonV1Spec()
  • Method Details

    • getModId

      @Input public abstract org.gradle.api.provider.Property<String> getModId()
      The ID of the mod.
      Returns:
      A Property containing a String representing the mod ID
    • getVersion

      @Input public abstract org.gradle.api.provider.Property<String> getVersion()
      The version of the mod.
      Returns:
      A Property containing a String representing the mod version
    • getName

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getName()
      The display name of the mod.
      Returns:
      A Property containing a String representing the mod name
    • getDescription

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getDescription()
      The description of the mod.
      Returns:
      A Property containing a String representing the mod description
    • getProvides

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<String> getProvides()
      A list of other mod IDs that this mod uses as aliases.
      Returns:
      A ListProperty containing a list of String representing the mod aliases
    • getEnvironment

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getEnvironment()
      The environment the mod runs in.

      One of `client`, `server`, or `*`.

      Returns:
      A Property containing a String representing the mod environment
    • client

      public void client()
      Sets the environment to 'client', indicating the mod only runs on the client side.
    • server

      public void server()
      Sets the environment to 'server', indicating the mod only runs on the server side.
    • getEntrypoints

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<FabricModJsonV1Spec.Entrypoint> getEntrypoints()
      A list of entrypoints for the mod.
      Returns:
      A ListProperty containing a list of FabricModJsonV1Spec.Entrypoint representing the mod entrypoints
    • entrypoint

      public void entrypoint(String entrypoint, String value)
      Add a new entrypoint with the given name and value.
      Parameters:
      entrypoint - The name of the entrypoint, such as "main" or "client"
      value - The value of the entrypoint, typically a fully qualified class name
    • entrypoint

      public void entrypoint(String entrypoint, String value, String adapter)
      Add a new entrypoint with the given name, value, and language adapter.
      Parameters:
      entrypoint - The name of the entrypoint, such as "main" or "client"
      value - The value of the entrypoint, typically a fully qualified class name
      adapter - The language adapter of the entrypoint, such as "kotlin" or "scala"
    • entrypoint

      public void entrypoint(String entrypoint, String value, org.gradle.api.Action<FabricModJsonV1Spec.Entrypoint> action)
      Add a new entrypoint with the given name and value, and configure it with the given action.
      Parameters:
      entrypoint - The name of the entrypoint, such as "main" or "client"
      value - The value of the entrypoint, typically a fully qualified class name
      action - An action to configure the entrypoint further
    • entrypoint

      public void entrypoint(String entrypoint, org.gradle.api.Action<FabricModJsonV1Spec.Entrypoint> action)
      Add a new entrypoint with the given name, and configure it with the given action.
      Parameters:
      entrypoint - The name of the entrypoint, such as "main" or "client"
      action - An action to configure the entrypoint
    • getJars

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<String> getJars()
      A list of additional JARs to load with the mod.

      A path relative to the root of the mod JAR.

      Returns:
      A ListProperty containing a list of String representing the additional JARs
    • getMixins

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<FabricModJsonV1Spec.Mixin> getMixins()
      A list of Mixin configurations for the mod.
      Returns:
      A ListProperty containing a list of FabricModJsonV1Spec.Mixin representing the mod Mixins
    • mixin

      public void mixin(String value)
      Add a new Mixin configuration with the given value.
      Parameters:
      value - The value of the Mixin configuration, typically a path to a JSON file
    • mixin

      public void mixin(String value, org.gradle.api.Action<FabricModJsonV1Spec.Mixin> action)
      Add a new Mixin configuration with the given value, and configure it with the given action.
      Parameters:
      value - The value of the Mixin configuration, typically a path to a JSON file
      action - An action to configure the Mixin further
    • mixin

      public void mixin(org.gradle.api.Action<FabricModJsonV1Spec.Mixin> action)
      Add a new Mixin configuration, and configure it with the given action.
      Parameters:
      action - An action to configure the Mixin
    • getAccessWidener

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getAccessWidener()
      The path to the access widener file for the mod.

      A path relative to the root of the mod JAR.

      Returns:
      A Property containing a String representing the access widener path
    • getDepends

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<FabricModJsonV1Spec.Dependency> getDepends()
      A list of depedencies that this mod depends on (required).
      Returns:
      A ListProperty containing a list of FabricModJsonV1Spec.Dependency representing the mod dependencies
    • depends

      public void depends(String modId, Iterable<String> versionRequirements)
      Add a required dependency on another mod with the given mod ID and version requirements.
      Parameters:
      modId - The mod ID of the dependency
      versionRequirements - A collection of version requirement strings
    • depends

      public void depends(String modId, String versionRequirement)
      Add a required dependency on another mod with the given mod ID and a single version requirement.
      Parameters:
      modId - The mod ID of the dependency
      versionRequirement - A version requirement string
    • depends

      public void depends(String modId, org.gradle.api.Action<FabricModJsonV1Spec.Dependency> action)
      Add a required dependency on another mod with the given mod ID, and configure it with the given action.
      Parameters:
      modId - The mod ID of the dependency
      action - An action to configure the dependency further
    • depends

      public void depends(org.gradle.api.Action<FabricModJsonV1Spec.Dependency> action)
      Add a required dependency, and configure it with the given action.
      Parameters:
      action - An action to configure the dependency
    • getRecommends

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<FabricModJsonV1Spec.Dependency> getRecommends()
      A list of recommended dependencies.
      Returns:
      A ListProperty containing a list of FabricModJsonV1Spec.Dependency representing the mod recommended dependencies
    • recommends

      public void recommends(String modId, Iterable<String> versionRequirements)
      Add a recommended dependency on another mod with the given mod ID and version requirements.
      Parameters:
      modId - The mod ID of the recommended dependency
      versionRequirements - A collection of version requirement strings
    • recommends

      public void recommends(String modId, String versionRequirement)
      Add a recommended dependency on another mod with the given mod ID and a single version requirement.
      Parameters:
      modId - The mod ID of the recommended dependency
      versionRequirement - A version requirement string
    • recommends

      public void recommends(String modId, org.gradle.api.Action<FabricModJsonV1Spec.Dependency> action)
      Add a recommended dependency on another mod with the given mod ID, and configure it with the given action.
      Parameters:
      modId - The mod ID of the recommended dependency
      action - An action to configure the recommended dependency further
    • recommends

      public void recommends(org.gradle.api.Action<FabricModJsonV1Spec.Dependency> action)
      Add a recommended dependency, and configure it with the given action.
      Parameters:
      action - An action to configure the recommended dependency
    • getSuggests

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<FabricModJsonV1Spec.Dependency> getSuggests()
      A list of suggested dependencies.
      Returns:
      A ListProperty containing a list of FabricModJsonV1Spec.Dependency representing the mod suggested dependencies
    • suggests

      public void suggests(String modId, Iterable<String> versionRequirements)
      Add a suggested dependency on another mod with the given mod ID and version requirements.
      Parameters:
      modId - The mod ID of the suggested dependency
      versionRequirements - A collection of version requirement strings
    • suggests

      public void suggests(String modId, String versionRequirement)
      Add a suggested dependency on another mod with the given mod ID and a single version requirement.
      Parameters:
      modId - The mod ID of the suggested dependency
      versionRequirement - A version requirement string
    • suggests

      public void suggests(String modId, org.gradle.api.Action<FabricModJsonV1Spec.Dependency> action)
      Add a suggested dependency on another mod with the given mod ID, and configure it with the given action.
      Parameters:
      modId - The mod ID of the suggested dependency
      action - An action to configure the suggested dependency further
    • suggests

      public void suggests(org.gradle.api.Action<FabricModJsonV1Spec.Dependency> action)
      Add a suggested dependency, and configure it with the given action.
      Parameters:
      action - An action to configure the suggested dependency
    • getConflicts

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<FabricModJsonV1Spec.Dependency> getConflicts()
      A list of conflicting dependencies.
      Returns:
      A ListProperty containing a list of FabricModJsonV1Spec.Dependency representing the mod conflicting dependencies
    • conflicts

      public void conflicts(String modId, Iterable<String> versionRequirements)
      Add a conflicting dependency on another mod with the given mod ID and version requirements.
      Parameters:
      modId - The mod ID of the conflicting dependency
      versionRequirements - A collection of version requirement strings
    • conflicts

      public void conflicts(String modId, String versionRequirement)
      Add a conflicting dependency on another mod with the given mod ID and a single version requirement.
      Parameters:
      modId - The mod ID of the conflicting dependency
      versionRequirement - A version requirement string
    • conflicts

      public void conflicts(String modId, org.gradle.api.Action<FabricModJsonV1Spec.Dependency> action)
      Add a conflicting dependency on another mod with the given mod ID, and configure it with the given action.
      Parameters:
      modId - The mod ID of the conflicting dependency
      action - An action to configure the conflicting dependency further
    • conflicts

      public void conflicts(org.gradle.api.Action<FabricModJsonV1Spec.Dependency> action)
      Add a conflicting dependency, and configure it with the given action.
      Parameters:
      action - An action to configure the conflicting dependency
    • getBreaks

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<FabricModJsonV1Spec.Dependency> getBreaks()
      A list of dependencies that this mod breaks.
      Returns:
      A ListProperty containing a list of FabricModJsonV1Spec.Dependency representing the mod broken dependencies
    • breaks

      public void breaks(String modId, Iterable<String> versionRequirements)
      Add a broken dependency on another mod with the given mod ID and version requirements.
      Parameters:
      modId - The mod ID of the broken dependency
      versionRequirements - A collection of version requirement strings
    • breaks

      public void breaks(String modId, String versionRequirement)
      Add a broken dependency on another mod with the given mod ID and a single version requirement.
      Parameters:
      modId - The mod ID of the broken dependency
      versionRequirement - A version requirement string
    • breaks

      public void breaks(String modId, org.gradle.api.Action<FabricModJsonV1Spec.Dependency> action)
      Add a broken dependency on another mod with the given mod ID, and configure it with the given action.
      Parameters:
      modId - The mod ID of the broken dependency
      action - An action to configure the broken dependency further
    • breaks

      public void breaks(org.gradle.api.Action<FabricModJsonV1Spec.Dependency> action)
      Add a broken dependency, and configure it with the given action.
      Parameters:
      action - An action to configure the broken dependency
    • getLicenses

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<String> getLicenses()
      A list of licenses for the mod.
      Returns:
      A ListProperty containing a list of String representing the mod licenses
    • getAuthors

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<FabricModJsonV1Spec.Person> getAuthors()
      A list of authors of the mod.
      Returns:
      A ListProperty containing a list of FabricModJsonV1Spec.Person representing the mod authors
    • author

      public void author(String name)
      Add a new author with the given name.
      Parameters:
      name - The name of the author
    • author

      public void author(String name, org.gradle.api.Action<FabricModJsonV1Spec.Person> action)
      Add a new author with the given name, and configure it with the given action.
      Parameters:
      name - The name of the author
      action - An action to configure the author further
    • author

      public void author(org.gradle.api.Action<FabricModJsonV1Spec.Person> action)
      Add a new author, and configure it with the given action.
      Parameters:
      action - An action to configure the author
    • getContributors

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<FabricModJsonV1Spec.Person> getContributors()
      A list of contributors to the mod.
      Returns:
      A ListProperty containing a list of FabricModJsonV1Spec.Person representing the mod contributors
    • contributor

      public void contributor(String name)
      Add a new contributor with the given name.
      Parameters:
      name - The name of the contributor
    • contributor

      public void contributor(String name, org.gradle.api.Action<FabricModJsonV1Spec.Person> action)
      Add a new contributor with the given name, and configure it with the given action.
      Parameters:
      name - The name of the contributor
      action - An action to configure the contributor further
    • contributor

      public void contributor(org.gradle.api.Action<FabricModJsonV1Spec.Person> action)
      Add a new contributor, and configure it with the given action.
      Parameters:
      action - An action to configure the contributor
    • getContactInformation

      @Input @Optional public abstract org.gradle.api.provider.MapProperty<String,String> getContactInformation()
      A map of contact information for the mod.

      The key is the platform (e.g. "email", "github", "discord") and the value is the contact detail for that platform.

      Returns:
      A MapProperty containing a map of String keys and String values representing the mod contact information
    • getIcons

      @Input @Optional public abstract org.gradle.api.provider.ListProperty<FabricModJsonV1Spec.Icon> getIcons()
      A list of icons for the mod.
      Returns:
      A ListProperty containing a list of FabricModJsonV1Spec.Icon representing the mod icons
    • icon

      public void icon(String path)
      Add a new icon with the given path.

      Note: Only 1 unsized icon is allowed. If you need to specify multiple icons or sizes, use icon(int, String)

      Parameters:
      path - The path to the icon file, relative to the root of the mod JAR
    • icon

      public void icon(int size, String path)
      Add a new icon with the given size and path.
      Parameters:
      size - The size of the icon in pixels (e.g. 16, 32, 64)
      path - The path to the icon file, relative to the root of the mod JAR
    • icon

      public void icon(String path, org.gradle.api.Action<FabricModJsonV1Spec.Icon> action)
      Add a new icon with the given path, and configure it with the given action.
      Parameters:
      path - The path to the icon file, relative to the root of the mod JAR
      action - An action to configure the icon further
    • icon

      public void icon(org.gradle.api.Action<FabricModJsonV1Spec.Icon> action)
      Add a new icon, and configure it with the given action.
      Parameters:
      action - An action to configure the icon
    • getLanguageAdapters

      @Input @Optional public abstract org.gradle.api.provider.MapProperty<String,String> getLanguageAdapters()
      A map of language adapters for the mod.

      The key is the adapter name and the value is the fully qualified class name of the adapter.

      Returns:
      A MapProperty containing a map of String keys and String values representing the mod language adapters
    • getCustomData

      @Input @Optional public abstract org.gradle.api.provider.MapProperty<String,Object> getCustomData()
      A map of custom data for the mod.

      This can be used by other tools to store additional information about the mod.

      The object is encoded to JSON using Gson, so it can be any type that Gson supports.

      Returns:
      A MapProperty containing a map of String keys and Object values representing the mod custom data
    • getObjectFactory

      @Inject @Internal protected abstract org.gradle.api.model.ObjectFactory getObjectFactory()