- plugins {
- id 'multiloader-loader'
- id 'net.minecraftforge.gradle' version '[6.0.24,6.2)'
- id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
- }
- base {
- archivesName = "${mod_name}-forge-${minecraft_version}"
- }
- mixin {
- config("${mod_id}.mixins.json")
- config("${mod_id}.forge.mixins.json")
- }
- minecraft {
- mappings channel: 'official', version: minecraft_version
- copyIdeResources = true //Calls processResources when in dev
- reobf = false // Forge 1.20.6+ uses official mappings at runtime, so we shouldn't reobf from official to SRG
- // Automatically enable forge AccessTransformers if the file exists
- // This location is hardcoded in Forge and can not be changed.
- // https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
- // Forge still uses SRG names during compile time, so we cannot use the common AT's
- def at = file('src/main/resources/META-INF/accesstransformer.cfg')
- if (at.exists()) {
- accessTransformer = at
- }
- runs {
- client {
- workingDirectory file('runs/client')
- ideaModule "${rootProject.name}.${project.name}.main"
- taskName 'Client'
- mods {
- modClientRun {
- source sourceSets.main
- }
- }
- }
- server {
- workingDirectory file('runs/server')
- ideaModule "${rootProject.name}.${project.name}.main"
- taskName 'Server'
- mods {
- modServerRun {
- source sourceSets.main
- }
- }
- }
- data {
- workingDirectory file('runs/data')
- ideaModule "${rootProject.name}.${project.name}.main"
- args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
- taskName 'Data'
- mods {
- modDataRun {
- source sourceSets.main
- }
- }
- }
- }
- }
- sourceSets.main.resources.srcDir 'src/generated/resources'
- dependencies {
- minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
- annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT:processor")
- // Forge's hack fix
- implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }
- }
- publishing {
- publications {
- mavenJava(MavenPublication) {
- fg.component(it)
- }
- }
- }
- sourceSets.each {
- def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
- it.output.resourcesDir = dir
- it.java.destinationDirectory = dir
- }