175 lines
6.1 KiB
Groovy
175 lines
6.1 KiB
Groovy
buildscript {
|
|
repositories {
|
|
maven { url = 'https://maven.minecraftforge.net' }
|
|
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
|
|
maven { url = 'https://maven.parchmentmc.org' }
|
|
mavenCentral()
|
|
gradlePluginPortal()
|
|
}
|
|
dependencies {
|
|
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
|
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
|
|
classpath 'org.parchmentmc:librarian:1.+'
|
|
classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2'
|
|
}
|
|
}
|
|
apply plugin: 'java'
|
|
apply plugin: 'net.minecraftforge.gradle'
|
|
apply plugin: 'eclipse'
|
|
apply plugin: 'org.spongepowered.mixin'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'org.parchmentmc.librarian.forgegradle'
|
|
apply plugin: 'com.github.johnrengelman.shadow'
|
|
|
|
apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/22e7d543a18cd30675277fbfa3669e3d9e206010/generic/secrets.gradle'
|
|
|
|
if (project.hasProperty('secretFile')) {
|
|
loadSecrets(new File((String) findProperty('secretFile')))
|
|
}
|
|
if (System.getenv('BUILD_NUMBER') != null) {
|
|
version += "." + System.getenv('BUILD_NUMBER')
|
|
}
|
|
|
|
jarJar.enable()
|
|
|
|
archivesBaseName = "${mod_id}-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: 'parchment', version: "${parchment_mappings}"
|
|
|
|
if (project.hasProperty('forge_ats_enabled') && project.findProperty('forge_ats_enabled').toBoolean()) {
|
|
// 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
|
|
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
|
project.logger.debug('Forge Access Transformers are enabled for this project.')
|
|
}
|
|
|
|
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"
|
|
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"
|
|
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"
|
|
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 {
|
|
url 'https://maven.blamejared.com'
|
|
}
|
|
flatDir {
|
|
dirs 'libs'
|
|
}
|
|
maven { url 'https://jitpack.io' }
|
|
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
|
compileOnly project(":Common")
|
|
implementation fg.deobf("net.darkhax.gamestages:GameStages-Forge-1.19.2:11.0.2")
|
|
implementation fg.deobf("net.darkhax.bookshelf:Bookshelf-Forge-1.19.2:16.1.9")
|
|
//minecraftLibrary("com.github.LlamaLad7:MixinExtras:${mixinextras_version}")
|
|
//jarJar(group: 'com.github.LlamaLad7', name: 'MixinExtras', version: "[${mixinextras_version},)")
|
|
//annotationProcessor("com.github.LlamaLad7:MixinExtras:${mixinextras_version}")
|
|
implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-common:${mixinextras_version}"))
|
|
implementation(jarJar("com.github.llamalad7.mixinextras:mixinextras-forge:${mixinextras_version}")) {
|
|
jarJar.ranged(it, "[${mixinextras_version},)")
|
|
}
|
|
annotationProcessor 'org.spongepowered:mixin:0.8.4-SNAPSHOT:processor'
|
|
|
|
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}")
|
|
}
|
|
}
|
|
|
|
reobf {
|
|
jarJar {}
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
source(project(":Common").sourceSets.main.allSource)
|
|
}
|
|
|
|
processResources {
|
|
from project(":Common").sourceSets.main.resources
|
|
|
|
filesMatching('*.mixins.json') {
|
|
expand "refmap_target": "${mod_id}."
|
|
}
|
|
}
|
|
|
|
|
|
jar.finalizedBy('reobfJar')
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
groupId project.group
|
|
artifactId project.archivesBaseName
|
|
version project.version
|
|
artifact jar
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
url "file://" + System.getenv("local_maven")
|
|
}
|
|
}
|
|
}
|