plugins { id 'multiloader-loader' id 'net.neoforged.moddev' } neoForge { version = neoforge_version // Automatically enable neoforge AccessTransformers if the file exists def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg') if (at.exists()) { accessTransformers.from(at.absolutePath) } runs { configureEach { systemProperty('neoforge.enabledGameTestNamespaces', mod_id) ideName = "NeoForge ${it.name.capitalize()} (${project.path})" // Unify the run config names with fabric } client { client() gameDirectory = this.mkdir(this.file("runs/client")) } data { clientData() gameDirectory = this.mkdir(this.file("runs/data")) // DataGen can be run by - "./gradlew :neoforge:runData" in Terminal. // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() } server { server() this.file("runs/server").createParentDirectories() gameDirectory = this.mkdir(this.file("runs/server")) } } mods { "${mod_id}" { sourceSet sourceSets.main } } } sourceSets.main.resources { srcDir 'src/generated/resources' } // Implement mcgradleconventions loader attribute def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String) ['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each { variant -> configurations.named("$variant") { attributes { attribute(loaderAttribute, 'neoforge') } } } sourceSets.configureEach { [it.compileClasspathConfigurationName, it.runtimeClasspathConfigurationName, it.getTaskName(null, 'jarJar')].each { variant -> configurations.named("$variant") { attributes { attribute(loaderAttribute, 'neoforge') } } } }