151 lines
4.9 KiB
Groovy
151 lines
4.9 KiB
Groovy
plugins {
|
|
id 'multiloader-loader'
|
|
id 'net.minecraftforge.gradle' version '[6.0.46,6.2)'
|
|
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
|
|
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
|
}
|
|
|
|
base {
|
|
archivesName = "${mod_id}-forge-${minecraft_version}"
|
|
}
|
|
|
|
mixin {
|
|
add sourceSets.main, "${mod_id}.refmap.json"
|
|
|
|
config "${mod_id}.mixins.json"
|
|
config "${mod_id}.forge.mixins.json"
|
|
}
|
|
|
|
tasks.named('jar', Jar).configure {
|
|
manifest {
|
|
attributes([
|
|
"MixinConfigs" : "${mod_id}.mixins.json,${mod_id}.forge.mixins.json"
|
|
])
|
|
}
|
|
}
|
|
|
|
jarJar.enable()
|
|
build.dependsOn tasks.jarJar
|
|
|
|
minecraft {
|
|
mappings channel: 'parchment', version: parchment_mappings
|
|
copyIdeResources = true
|
|
reobf = false
|
|
|
|
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
|
|
if (at.exists()) {
|
|
accessTransformer = at
|
|
}
|
|
|
|
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"
|
|
property 'eventbus.api.strictRuntimeChecks', 'true'
|
|
args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}.forge.mixins.json"
|
|
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"
|
|
property 'eventbus.api.strictRuntimeChecks', 'true'
|
|
args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}.forge.mixins.json"
|
|
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"
|
|
property 'eventbus.api.strictRuntimeChecks', 'true'
|
|
args "-mixin.config=${mod_id}.mixins.json", "-mixin.config=${mod_id}.forge.mixins.json"
|
|
mods {
|
|
modDataRun {
|
|
source sourceSets.main
|
|
source project(":Common").sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
sourceSets.main.resources.srcDir 'src/generated/resources'
|
|
|
|
repositories {
|
|
maven {
|
|
name = "Shedaniel"
|
|
url "https://maven.shedaniel.me/"
|
|
}
|
|
|
|
maven { url 'https://jitpack.io' }
|
|
|
|
flatDir {
|
|
dirs 'libs'
|
|
}
|
|
|
|
}
|
|
|
|
|
|
dependencies {
|
|
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
|
compileOnly project(":Common")
|
|
annotationProcessor 'org.spongepowered:mixin:0.8.5-SNAPSHOT:processor'
|
|
annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.7'
|
|
// Hack fix for now, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
|
|
implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }
|
|
|
|
testCompileOnly(compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}")))
|
|
implementation(jarJar("io.github.llamalad7:mixinextras-forge:${mixinextras_version}")) {
|
|
jarJar.ranged(it, "[${mixinextras_version},)")
|
|
}
|
|
|
|
//implementation fg.deobf("net.darkhax.gamestages:GameStages-Forge-1.19.2:11.0.2")
|
|
|
|
compileOnly(fg.deobf("me.shedaniel.cloth:cloth-config-neoforge:${cloth_config_version}"))
|
|
|
|
fileTree("libs").matching {
|
|
include "*.jar"
|
|
}.each {
|
|
String filename = it.getName();
|
|
filename = filename.substring(0, filename.length() - 4);
|
|
int lastDash = filename.lastIndexOf("-");
|
|
filename = filename.substring(0, lastDash) + ":" + filename.substring(lastDash+1, filename.length());
|
|
implementation fg.deobf("blank:${filename}")
|
|
}
|
|
|
|
|
|
}
|
|
|
|
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
|
|
} |