@@ -20,28 +20,30 @@ open class FabricExtension(private val project: Project) : BaseExtension(project
20
20
project.dependencies.add(" modImplementation" , " net.fabricmc:fabric-loader:${fabricLoaderVersion} " )
21
21
project.dependencies.add(" modImplementation" , " net.fabricmc.fabric-api:fabric-api:${fabricApiVersion} " )
22
22
23
- project.extensions.getByType<LoomGradleExtensionAPI >().apply {
24
- val accessWidenerFile = project.file(" src/main/resources/${modId!! } .accesswidener" )
25
- if (accessWidenerFile.exists()) {
26
- accessWidenerPath.set(accessWidenerFile)
27
- }
28
- runs {
29
- getByName(" client" ) {
30
- client()
31
- setConfigName(" Fabric Client" )
32
- ideConfigGenerated(true )
33
- runDir(" run" )
23
+ if (modId != null ) {
24
+ project.extensions.getByType<LoomGradleExtensionAPI >().apply {
25
+ val accessWidenerFile = project.file(" src/main/resources/${modId!! } .accesswidener" )
26
+ if (accessWidenerFile.exists()) {
27
+ accessWidenerPath.set(accessWidenerFile)
34
28
}
35
- getByName(" server" ) {
36
- server()
37
- setConfigName(" Fabric Server" )
38
- ideConfigGenerated(true )
39
- runDir(" run" )
29
+ runs {
30
+ getByName(" client" ) {
31
+ client()
32
+ setConfigName(" Fabric Client" )
33
+ ideConfigGenerated(true )
34
+ runDir(" run" )
35
+ }
36
+ getByName(" server" ) {
37
+ server()
38
+ setConfigName(" Fabric Server" )
39
+ ideConfigGenerated(true )
40
+ runDir(" run" )
41
+ }
42
+ }
43
+ mixin {
44
+ showMessageTypes.set(true )
45
+ messages.put(" TARGET_ELEMENT_NOT_FOUND" , " disabled" )
40
46
}
41
- }
42
- mixin {
43
- showMessageTypes.set(true )
44
- messages.put(" TARGET_ELEMENT_NOT_FOUND" , " disabled" )
45
47
}
46
48
}
47
49
project.tasks.withType<Jar >().configureEach {
@@ -55,6 +57,7 @@ open class FabricExtension(private val project: Project) : BaseExtension(project
55
57
}
56
58
57
59
fun compileWithProject (dependency : Project ) {
60
+ project.evaluationDependsOn(" :" + dependency.name)
58
61
val sourceSets = dependency.extensions.getByType<JavaPluginExtension >().sourceSets
59
62
project.tasks.withType<JavaCompile >().configureEach {
60
63
source(sourceSets[" main" ].allSource)
0 commit comments