Interface SlimeLauncherOptions

All Superinterfaces:
Named

public sealed interface SlimeLauncherOptions extends Named

The configuration options for Slime Launcher tasks.

The launch tasks generated by the Minecraft extension are specialized JavaExec tasks that are designed to work with Slime Launcher, Minecraft Forge's dedicated launcher for the development environment. While the implementing task class remains internal (can still be configured as type JavaExec), these options exist to allow consumers to alter or add pre-defined attributes to the run configurations as needed.

For example, changing the main class of the launch task as a JavaExec task will cause it to not use Slime Launcher and skip its configurations for it. If a consumer wishes to use Slime Launcher but change the main class it delegates to after initial setup, that can be done using Property.set(T) on getMainClass().

API Note:
This class is public-facing as a class instead of an interface to satisfy the requirement that Gradle's NamedDomainObjectContainer must house a class that implements the Named interface. Like the other public-facing interface APIs in ForgeGradle, this class remains sealed and is implemented by a package-private class that cannot be directly accessed.
  • Method Details

    • getMainClass

      Property<String> getMainClass()

      The main class for Slime Launcher to use.

      This is the class that will be invoked by Slime Launcher, not the main class of the JavaExec task that will be produced from these options.

      Returns:
      A property for the main class
    • getArgs

      ListProperty<Object> getArgs()

      The arguments to pass to the main class.

      This is the arguments that will be passed to the main class through Slime Launcher, not the arguments for Slime Launcher itself.

      Returns:
      A property for the arguments to pass to the main class
    • getJvmArgs

      ListProperty<Object> getJvmArgs()

      The JVM arguments to use.

      These are applied immediately when Slime Launcher is executed. A reminder that Slime Launcher is not a re-launcher but a dev-environment bootstrapper.

      Returns:
      A property for the JVM arguments
    • getClasspath

      The classpath to use.

      The classpath in question must include Slime Launcher in it. By default, the minecraft extension adds Slime Launcher as a dependency to the consuming project's runtimeClasspath configuration.

      Keep in mind that if the JavaExec task is configured to have a different main class, the classpath does not need to include Slime Launcher.

      Returns:
      The classpath to use
    • getMinHeapSize

      Property<String> getMinHeapSize()

      The minimum memory heap size to use.

      Working with this property is preferred over manually using the -Xms argument in the JVM arguments.

      Returns:
      A property for the minimum heap size
    • getMaxHeapSize

      Property<String> getMaxHeapSize()

      The maximum memory heap size to use.

      Working with this property is preferred over manually using the -Xmx argument in the JVM arguments.

      Returns:
      A property for the maximum heap size
    • getSystemProperties

      MapProperty<String,Object> getSystemProperties()
      The system properties to use.
      Returns:
      A property for the system properties
    • getEnvironment

      MapProperty<String,Object> getEnvironment()
      The environment variables to use.
      Returns:
      A property for the environment variables
    • getWorkingDir

      DirectoryProperty getWorkingDir()

      The working directory to use.

      By default, this will be run/name.

      To clarify: this is the working directory of the Java process. Slime Launcher uses absolute file locations to place its caches and metadata, which do not interfere with the working directory.

      Returns:
      A property for the working directory
    • args

      default void args(Object args)
      Adds to the arguments to pass to the main class.
      Parameters:
      args - The arguments to add
      See Also:
      API Note:
      To add multiple arguments, use args(Object...)
    • args

      default void args(Object... args)
      Adds to the arguments to pass to the main class.
      Parameters:
      args - The arguments to add
      See Also:
      API Note:
      Unlike setArgs(String...), this method does not replace the existing arguments.
    • args

      default void args(Iterable<?> args)
      Adds to the arguments to pass to the main class.
      Parameters:
      args - The arguments to add
      See Also:
      API Note:
      Unlike HasMultipleValues.set(Iterable), this method does not replace the existing arguments.
    • args

      default void args(Provider<? extends Iterable<?>> args)
      Adds to the arguments to pass to the main class.
      Parameters:
      args - The arguments to add
      See Also:
      API Note:
      Unlike HasMultipleValues.set(Provider), this method does not replace the existing arguments.
    • setArgs

      default void setArgs(String... args)
      Sets the arguments to pass to the main class.
      Parameters:
      args - The arguments
      See Also:
    • jvmArgs

      default void jvmArgs(Object jvmArgs)
      Adds to the JVM arguments to use.
      Parameters:
      jvmArgs - The JVM argument to add
      See Also:
      API Note:
      To add multiple arguments, use jvmArgs(Object...)
    • jvmArgs

      default void jvmArgs(Object... jvmArgs)
      Adds to the JVM arguments to use.
      Parameters:
      jvmArgs - The JVM arguments to add
      See Also:
      API Note:
      Unlike setJvmArgs(Object...), this method does not replace the existing arguments.
    • jvmArgs

      default void jvmArgs(Iterable<?> jvmArgs)
      Adds to the JVM arguments to use.
      Parameters:
      jvmArgs - The JVM arguments to add
      See Also:
      API Note:
      Unlike HasMultipleValues.set(Iterable), this method does not replace the existing arguments.
    • jvmArgs

      default void jvmArgs(Provider<? extends Iterable<?>> jvmArgs)
      Adds to the JVM arguments to use.
      Parameters:
      jvmArgs - The JVM arguments to add
      See Also:
      API Note:
      Unlike HasMultipleValues.set(Provider), this method does not replace the existing arguments.
    • setJvmArgs

      default void setJvmArgs(Object... jvmArgs)
      Sets the JVM arguments to use.
      Parameters:
      jvmArgs - The arguments
      See Also:
    • classpath

      default void classpath(Object... classpath)
      Adds to the classpath to use.
      Parameters:
      classpath - The classpath to include with the existing classpath
      See Also:
      API Note:
      Unlike setClasspath(Object...), this method does not replace the existing classpath.
    • classpath

      default void classpath(Iterable<?> classpath)
      Adds to the classpath to use.
      Parameters:
      classpath - The classpath to include with the existing classpath
      See Also:
      API Note:
      Unlike setClasspath(Iterable), this method does not replace the existing classpath.
    • classpath

      default void classpath(FileCollection classpath)
      Adds to the classpath to use.
      Parameters:
      classpath - The classpath to include with the existing classpath
      See Also:
      API Note:
      Unlike setClasspath(FileCollection), this method does not replace the existing classpath.
    • setClasspath

      default void setClasspath(Object... classpath)
      Sets the classpath to use.
      Parameters:
      classpath - The classpath
      See Also:
      API Note:
      This method will replace the existing classpath. To add to it, use classpath(Object...).
    • setClasspath

      default void setClasspath(Iterable<?> classpath)
      Sets the classpath to use.
      Parameters:
      classpath - The classpath
      See Also:
      API Note:
      This method will replace the existing classpath. To add to it, use classpath(Iterable).
    • setClasspath

      default void setClasspath(FileCollection classpath)
      Sets the classpath to use.
      Parameters:
      classpath - The classpath
      See Also:
      API Note:
      This method will replace the existing classpath. To add to it, use classpath(FileCollection).
    • systemProperty

      default void systemProperty(String name, Object value)
      Adds a single system property to use.
      Parameters:
      name - The name
      value - The value
      See Also:
      API Note:
      To add multiple system properties at once, use systemProperties(Provider).
    • systemProperties

      default void systemProperties(Map<String,?> properties)
      Adds to the system properties to use.
      Parameters:
      properties - The system properties
      See Also:
      API Note:
      Unlike MapProperty.set(Map), this method does not replace the existing system properties. To add a single property, use systemProperty(String,Object).
    • systemProperties

      default void systemProperties(Provider<? extends Map<String,?>> properties)
      Adds to the system properties to use.
      Parameters:
      properties - The system properties
      See Also:
      API Note:
      Unlike MapProperty.set(Provider), this method does not replace the existing system properties. To add a single property, use systemProperty(String,Object).
    • environment

      default void environment(String name, Object value)
      Adds a single environment variable to use.
      Parameters:
      name - The name
      value - The value
      See Also:
      API Note:
      To add multiple environment variables at once, use environment(Provider).
    • environment

      default void environment(Map<String,?> properties)
      Adds to the environment variables to use.
      Parameters:
      properties - The environment variables
      See Also:
      API Note:
      Unlike MapProperty.set(Map), this method does not replace the existing environment variables. To add a single variable, use environment(String,Object).
    • environment

      default void environment(Provider<? extends Map<String,?>> properties)
      Adds to the environment variables to use.
      Parameters:
      properties - The environment variables
      See Also:
      API Note:
      Unlike MapProperty.set(Provider), this method does not replace the existing environment variables. To add a single variable, use environment(String,Object).