MultiLoader-Template/forge/build.gradle
Jared 531f251168 AccessTransformers and AccessWideners now apply if the file is present
AccessWideners are shared on common and fabric, since you will most likely need them in common anyway, and they are faster to apply than AccessTransformers
2023-06-11 03:33:12 +02:00

104 lines
3.2 KiB
Groovy

plugins {
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle'
id 'org.spongepowered.mixin'
}
archivesBaseName = "${mod_name}-forge-${minecraft_version}"
mixin {
add(sourceSets.main, "${mod_id}.refmap.json")
config("${mod_id}.mixins.json")
config("${mod_id}.forge.mixins.json")
}
minecraft {
mappings channel: 'official', version: minecraft_version
// 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
if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
}
runs {
client {
workingDirectory project.file('run')
ideaModule "${rootProject.name}.${project.name}.main"
taskName 'Client'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
modClientRun {
source sourceSets.main
source project(":common").sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
ideaModule "${rootProject.name}.${project.name}.main"
taskName 'Server'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
modServerRun {
source sourceSets.main
source project(":common").sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
ideaModule "${rootProject.name}.${project.name}.main"
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
taskName 'Data'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
modDataRun {
source sourceSets.main
source project(":common").sourceSets.main
}
}
}
}
}
sourceSets.main.resources.srcDir 'src/generated/resources'
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
compileOnly project(":common")
annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT:processor")
}
tasks.withType(JavaCompile) {
source(project(":common").sourceSets.main.allSource)
}
processResources {
from project(":common").sourceSets.main.resources
}
jar.finalizedBy('reobfJar')
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
url "file://" + System.getenv("local_maven")
}
}
}