Loom Options 26.2
Reference for all options of the Fabric Loom Gradle plugin.
This page contains a reference for all options present in the loom Gradle extension. Please see the Fabric API DSL page for options related to Fabric API specific features.
gradle
loom {
// Set the class tweaker file path, see https://docs.fabricmc.net/develop/class-tweakers/
accessWidenerPath = file("src/main/resources/example-mod.classtweaker")
// Add additional log4j config files.
log4jConfigs.from(file("log4j.xml"))
// When enabled the output archives will be automatically remapped.
remapArchives = true
// When enabled the -dev jars in the *Elements configurations will be replaced by the remapped jars
setupRemappedVariants = true
// When enabled transitive access wideners will be applied from dependencies.
enableTransitiveAccessWideners = true
// When enabled log4j will only be on the runtime classpath, forcing the use of SLF4j.
runtimeOnlyLog4j = false
// When set only server related features and jars will be setup.
serverOnlyMinecraftJar()
// When set the minecraft jar will be split into common and clientonly. Highly experimental, fabric-loader does not support this option yet.
splitMinecraftJar()
// Used to configure existing or new run configurations
runs {
client {
// Add JVM arguments
jvmArguments.add("-Dexample=true")
// Add a JVM property
systemProperties.put("example", "true")
// Add program arguments
programArguments.add("--example")
// Add an environment variable
environmentVars.put("example", "true")
// The environment (or side) to run, usually client or server.
runtimeEnvironment = "client"
// The full name of the run configuration, i.e. 'Minecraft Client'. By default this is determined from the base name.
displayName = "Minecraft Client"
// Whether to append the project path to the display name in non-root projects.
appendProjectPathToDisplayName = true
// The main class of the run configuration. This defaults to the main class specified in the loader metadata.
mainClass = ""
// The run directory for this configuration, relative to the root project directory.
runDirectory = file("run")
// The name of the source set to run.
sourceSet = sourceSets.main.name
// When true a run configuration file will be generated for IDE's. By default only set to true for the root project.
generateRunConfig = true
// When true, generated IDE run configurations prefer using the corresponding Gradle run task.
preferGradleTask = false
// Group the run configuration under this folder in IntelliJ IDEA.
ideConfigFolder = "Minecraft"
// The true entrypoint, usually dev launch injector. This should not normally be changed.
devLaunchMainClass = "net.fabricmc.devlaunchinjector.Main"
// Configure run config with the default client options.
client()
// Configure run config with the default server options.
server()
}
// Example of creating a basic run config for tests
testClient {
// Copies settings from another run configuration.
inherit client
displayName = "Test Minecraft Client"
sourceSet = sourceSets.test.name
}
// Example of removing the built-in server configuration
remove server
}
// Configure all run configs to generate ide run configurations. Useful for sub projects.
runs.configureEach {
generateRunConfig = true
}
// Used to configure mixin options or apply to additional source sets.
mixin {
// When disabled tiny remapper will be used to remap Mixins instead of the AP. (Disabled by default in Loom 1.12+)
useLegacyMixinAp = true
// Set the default refmap name
defaultRefmapName = "example.refmap.json"
// See https://github.com/FabricMC/fabric-loom/blob/dev/0.11/src/main/java/net/fabricmc/loom/api/MixinExtensionAPI.java for options to add additional source sets
}
// Configure or add new decompilers
decompilers {
// Configure a default decompiler, either cfr, fernflower or vineflower
cfr {
// Pass additional options to the decompiler
options += [
key: "value"
]
// Set the amount of memory in megabytes used when forking the JVM
memory = 4096
// Set the maximum number of threads that the decompiler can use.
maxThreads = 8
}
}
interfaceInjection {
// When enabled injected interfaces from dependencies will be applied.
enableDependencyInterfaceInjection = true
}
// Splits the Minecraft jar and incoming dependencies across the main (common) and client only source sets.
// This provides compile time safety for accessing client only code.
splitEnvironmentSourceSets()
// This mods block is used group mods that are made up of multiple classpath entries.
mods {
example-mod {
// When using split sources you should add the main and client source set
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
// Create modExampleImplementation and related configurations that remap mods.
createRemapConfigurations(sourceSets.example)
// Specifies the fabric.mod.json file location used in injected interface processing.
// Defaults to src/main/resources/fabric.mod.json or src/client/resources/fabric.mod.json
fabricModJsonPath = file("src/custom/resources/fabric.mod.json")
}
remapJar {
// Set the input jar for the task, also valid for remapSourcesJar
inputFile = file("example.jar")
// Set the source namespace, also valid for remapSourcesJar
sourceNamespace = "named"
// Set the target namespace, also valid for remapSourcesJar
targetNamespace = "intermediary"
// Add additional jar files to the remap classpath, also valid for remapSourcesJar
classpath.from file("classpath.jar")
// Add a nested mod jar to this task, the include configuration should be used for maven libraries and mods.
nestedJars.from file("nested.jar")
// When enabled nested jars will be included with the output jar.
addNestedDependencies = true
}
dependencies {
// Set the Minecraft version.
minecraft "com.mojang:minecraft:1.18.1"
// Use mappings from maven.
mappings "net.fabricmc:yarn:1.18.1+build.22:v2"
// Use the official Mojang mappings
mappings loom.officialMojangMappings()
// Layered mappings using official Mojang mappings and Parchment.
mappings loom.layered() {
officialMojangMappings()
// Use Parchment mappings. NOTE: Parchment maven must be manually added. (https://maven.parchmentmc.org)
parchment("org.parchmentmc.data:parchment-1.17.1:2021.09.05@zip")
}
// Remap a mod from maven and apply to Gradle's implementation configuration
// (Minor detail: it's not exactly applied *to* the configuration, but a clone of it intended for mod dependencies)
modImplementation "net.fabricmc.fabric-api:fabric-api:0.46.2+1.18"
// Remap a mod from maven and apply to Gradle's api configuration
modApi "net.fabricmc.fabric-api:fabric-api:0.46.2+1.18"
// Remap a mod from maven and apply to Gradle's compileOnly configuration
modCompileOnly "net.fabricmc.fabric-api:fabric-api:0.46.2+1.18"
// Remap a mod from maven and apply to Gradle's compileOnlyApi configuration
modCompileOnlyApi "net.fabricmc.fabric-api:fabric-api:0.46.2+1.18"
// Remap a mod from maven and apply to Gradle's runtimeOnly configuration
modRuntimeOnly "net.fabricmc.fabric-api:fabric-api:0.46.2+1.18"
// Remap a mod from maven and apply to loom's localRuntime configuration.
// Behaves like runtimeOnly but is not exposed in to dependents. A bit like testRuntimeOnly but for mods.
modLocalRuntime "net.fabricmc.fabric-api:fabric-api:0.46.2+1.18"
// Include a mod jar in the remapped jar. Not transitive.
include "example:example-mod:1.1.1"
// Include a non-mod library jar in the remapped jar. A dummy mod will be generated. Not transitive.
include "example:example-lib:1.1.1"
// Helper to aid with depending on a specific Fabric API version.
modImplementation fabricApi.module("fabric-api-base", "0.46.2+1.18")
// Depend on a loom subproject by using the namedElements configuration.
implementation project(path: ":name", configuration: "namedElements")
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
Migrating run configurations from the old API
The new property based API is available in Loom 1.17 and later.
Replace the old run configuration methods and properties with their property-based equivalents:
| Old API | Property-based API |
|---|---|
vmArg(value) / vmArgs(values) | jvmArguments.add(value) / jvmArguments.addAll(values) |
programArg(value) / programArgs(values) | programArguments.add(value) / programArguments.addAll(values) |
environmentVariable(name, value) | environmentVars.put(name, value) |
property(name, value) / properties(values) | systemProperties.put(name, value) / systemProperties.putAll(values) |
environment = value | runtimeEnvironment = value |
configName = value / name(value) | displayName = value |
defaultMainClass = value | mainClass = value |
runDir = value / runDir(value) | runDirectory = file(value) |
source = sourceSet / source(sourceSet) | sourceSet = sourceSet.name |
ideConfigGenerated = value | generateRunConfig = value |








