Class RunModel

java.lang.Object
net.neoforged.moddevgradle.dsl.RunModel
All Implemented Interfaces:
org.gradle.api.artifacts.dsl.Dependencies, org.gradle.api.Named

public abstract class RunModel extends Object implements org.gradle.api.Named, org.gradle.api.artifacts.dsl.Dependencies
Model of a run. Each run will generate a runXxx gradle task and optionally (enabled by default) a corresponding IDE run.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Constructor Summary

    Constructors
    Constructor
    Description
    RunModel(String name, org.gradle.api.Project project, Iterable<ModModel> defaultMods)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Equivalent to setting type = "client".
    void
    Equivalent to setting type = "clientData".
    void
    Equivalent to setting type = "data".
    void
    Equivalent to setting ideName = ""
    void
    environment(String key, String value)
    Shorthand to set a single environment variable.
    org.gradle.api.artifacts.Configuration
     
    abstract org.gradle.api.provider.Property<Boolean>
    Enables DevLogin which is used to log into an official Minecraft account in development environments.
    abstract org.gradle.api.provider.MapProperty<String,String>
    Additional environment variables.
    abstract org.gradle.api.file.DirectoryProperty
    Directory that the game will run in.
    abstract org.gradle.api.provider.Property<String>
    Name for the run configuration in the IDE.
    abstract org.gradle.api.provider.ListProperty<String>
    Additional JVM arguments to be added to the run configuration.
    abstract org.gradle.api.provider.SetProperty<ModModel>
    The mods for this run.
    abstract org.gradle.api.file.RegularFileProperty
    Overrides the log4j2.xml configuration file.
    abstract org.gradle.api.provider.Property<org.slf4j.event.Level>
    Changes the games log-level.
    abstract org.gradle.api.provider.Property<String>
    Allows overriding the main class for this run.
     
    abstract org.gradle.api.provider.ListProperty<String>
    Additional program arguments to add to the run configuration.
    abstract org.gradle.api.provider.Property<org.gradle.api.tasks.SourceSet>
    Sets the source set to be used as the main classpath of this run.
    abstract org.gradle.api.provider.MapProperty<String,String>
    Additional system properties to add to the JVM arguments.
    List<org.gradle.api.tasks.TaskProvider<?>>
    Gets the Gradle tasks that should be run before running this run.
    abstract org.gradle.api.provider.Property<String>
    Sets the run configuration type from NeoForge that should be used.
    void
    Shorthand to add a single JVM argument.
    void
    Shorthand to add a single program argument.
    void
    Equivalent to setting type = "server".
    void
    Equivalent to setting type = "serverData".
    void
    setTasksBefore(List<org.gradle.api.tasks.TaskProvider<?>> taskNames)
    Sets the Gradle tasks that should be run before running this run.
    void
    Shorthand to set a single system property.
    void
    taskBefore(org.gradle.api.Task task)
    Configures the given Task to be run before launching the game.
    void
    taskBefore(org.gradle.api.tasks.TaskProvider<?> task)
    Configures the given Task to be run before launching the game.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.gradle.api.artifacts.dsl.Dependencies

    constraint, constraint, constraint, constraint, getDependencyConstraintFactory, getDependencyFactory, getObjectFactory, getProject, module, module, project, project
  • Constructor Details

    • RunModel

      @Inject public RunModel(String name, org.gradle.api.Project project, Iterable<ModModel> defaultMods)
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface org.gradle.api.Named
    • getIdeName

      public abstract org.gradle.api.provider.Property<String> getIdeName()
      Name for the run configuration in the IDE. If this is set to "", no config will be generated.
    • getGameDirectory

      public abstract org.gradle.api.file.DirectoryProperty getGameDirectory()
      Directory that the game will run in. Defaults to run/.
    • getEnvironment

      public abstract org.gradle.api.provider.MapProperty<String,String> getEnvironment()
      Additional environment variables.
    • environment

      public void environment(String key, String value)
      Shorthand to set a single environment variable.
    • getSystemProperties

      public abstract org.gradle.api.provider.MapProperty<String,String> getSystemProperties()
      Additional system properties to add to the JVM arguments.
    • systemProperty

      public void systemProperty(String key, String value)
      Shorthand to set a single system property.
    • getMainClass

      public abstract org.gradle.api.provider.Property<String> getMainClass()
      Allows overriding the main class for this run.
    • getProgramArguments

      public abstract org.gradle.api.provider.ListProperty<String> getProgramArguments()
      Additional program arguments to add to the run configuration.
    • programArgument

      public void programArgument(String arg)
      Shorthand to add a single program argument.
    • getJvmArguments

      public abstract org.gradle.api.provider.ListProperty<String> getJvmArguments()
      Additional JVM arguments to be added to the run configuration.
    • jvmArgument

      public void jvmArgument(String arg)
      Shorthand to add a single JVM argument.
    • getLoadedMods

      public abstract org.gradle.api.provider.SetProperty<ModModel> getLoadedMods()
      The mods for this run. Defaults to all mods registered in the project.
      See Also:
    • getType

      public abstract org.gradle.api.provider.Property<String> getType()
      Sets the run configuration type from NeoForge that should be used.
    • client

      public void client()
      Equivalent to setting type = "client".
    • clientData

      public void clientData()
      Equivalent to setting type = "clientData".

      Should only be used for Minecraft versions starting from 1.21.4. (The first snapshot that supports this is 24w45a).

    • data

      public void data()
      Equivalent to setting type = "data".

      Should only be used for Minecraft versions up to 1.21.3 included. (The last snapshot that supports this is 24w44a).

    • server

      public void server()
      Equivalent to setting type = "server".
    • serverData

      public void serverData()
      Equivalent to setting type = "serverData".

      Should only be used for Minecraft versions starting from 1.21.4. (The first snapshot that supports this is 24w45a).

    • disableIdeRun

      public void disableIdeRun()
      Equivalent to setting ideName = ""
    • getTasksBefore

      public List<org.gradle.api.tasks.TaskProvider<?>> getTasksBefore()
      Gets the Gradle tasks that should be run before running this run.
    • setTasksBefore

      public void setTasksBefore(List<org.gradle.api.tasks.TaskProvider<?>> taskNames)
      Sets the Gradle tasks that should be run before running this run. This also slows down running through your IDE since it will first execute Gradle to run the requested tasks, and then run the actual game.
    • taskBefore

      public void taskBefore(org.gradle.api.tasks.TaskProvider<?> task)
      Configures the given Task to be run before launching the game. This also slows down running through your IDE since it will first execute Gradle to run the requested tasks, and then run the actual game.
    • taskBefore

      public void taskBefore(org.gradle.api.Task task)
      Configures the given Task to be run before launching the game. This also slows down running through your IDE since it will first execute Gradle to run the requested tasks, and then run the actual game.
    • getAdditionalRuntimeClasspathConfiguration

      public org.gradle.api.artifacts.Configuration getAdditionalRuntimeClasspathConfiguration()
    • getLogLevel

      public abstract org.gradle.api.provider.Property<org.slf4j.event.Level> getLogLevel()
      Changes the games log-level.

      Note that this property is ignored if getLoggingConfigFile() is set.

    • getLoggingConfigFile

      public abstract org.gradle.api.file.RegularFileProperty getLoggingConfigFile()
      Overrides the log4j2.xml configuration file. If unset, MDG will use a default configuration file with the chosen log level.
    • getSourceSet

      public abstract org.gradle.api.provider.Property<org.gradle.api.tasks.SourceSet> getSourceSet()
      Sets the source set to be used as the main classpath of this run. Defaults to the main source set. Eclipse does not support having multiple different classpaths per project beyond a separate unit-testing classpath.
    • getDevLogin

      public abstract org.gradle.api.provider.Property<Boolean> getDevLogin()
      Enables DevLogin which is used to log into an official Minecraft account in development environments.
    • toString

      public String toString()
      Overrides:
      toString in class Object