259 lines
7.6 KiB
Groovy
259 lines
7.6 KiB
Groovy
//file:noinspection GroovyAssignabilityCheck
|
|
buildscript {
|
|
repositories {
|
|
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id 'eclipse'
|
|
id 'idea'
|
|
id 'maven-publish'
|
|
id 'net.minecraftforge.gradle' version '[6.0.16,6.2)'
|
|
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
|
}
|
|
|
|
apply plugin: 'org.spongepowered.mixin'
|
|
|
|
group = mod_group_id
|
|
version = mod_version
|
|
|
|
base {
|
|
archivesName = mod_id
|
|
}
|
|
|
|
java {
|
|
withSourcesJar()
|
|
withJavadocJar()
|
|
toolchain.languageVersion = JavaLanguageVersion.of(17)
|
|
}
|
|
|
|
minecraft {
|
|
mappings channel: mapping_channel, version: mapping_version
|
|
|
|
copyIdeResources = true
|
|
|
|
runs {
|
|
configureEach {
|
|
workingDirectory(file('run'))
|
|
|
|
property 'forge.logging.markers', 'REGISTRIES'
|
|
|
|
property 'forge.logging.console.level', 'debug'
|
|
|
|
mods {
|
|
"${mod_id}" {
|
|
source sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
|
|
var client = client {
|
|
property 'forge.enabledGameTestNamespaces', mod_id
|
|
property 'mixin.env.remapRefMap', 'true'
|
|
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
|
}
|
|
|
|
client_0 {
|
|
parent(client)
|
|
args("--username", "player_0")
|
|
}
|
|
|
|
client_1 {
|
|
parent(client)
|
|
args("--username", "player_1")
|
|
}
|
|
|
|
server {
|
|
property 'forge.enabledGameTestNamespaces', mod_id
|
|
property 'mixin.env.remapRefMap', 'true'
|
|
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
|
args '--nogui'
|
|
}
|
|
|
|
gameTestServer {
|
|
property 'forge.enabledGameTestNamespaces', mod_id
|
|
}
|
|
|
|
data {
|
|
workingDirectory(file('run-data'))
|
|
property('gradle.task', 'runData')
|
|
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
|
}
|
|
}
|
|
}
|
|
|
|
mixin {
|
|
add sourceSets.main, "${mod_id}.refmap.json"
|
|
config "${mod_id}.mixins.json"
|
|
}
|
|
|
|
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
|
|
|
repositories {
|
|
flatDir {
|
|
dir 'libs'
|
|
}
|
|
maven { // TOP
|
|
url "https://cursemaven.com"
|
|
}
|
|
maven { //mirror
|
|
name = "ModMaven"
|
|
url = "https://modmaven.dev"
|
|
}
|
|
maven {
|
|
name "KosmX's maven"
|
|
url 'https://maven.kosmx.dev/'
|
|
}
|
|
maven {
|
|
name = "Illusive Soulworks maven"
|
|
url = "https://maven.theillusivec4.top/"
|
|
}
|
|
}
|
|
|
|
jarJar.enable()
|
|
|
|
dependencies {
|
|
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
|
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
|
compileOnly 'org.spongepowered:mixin:0.8.5'
|
|
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.1"))
|
|
implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.4.1") {
|
|
jarJar.ranged(it, "[0.4.1,)")
|
|
})
|
|
|
|
implementation fg.deobf("dev.kosmx.player-anim:player-animation-lib-forge:1.0.2-rc1+1.20")
|
|
implementation fg.deobf("io.github.kosmx.bendy-lib:bendy-lib-forge:4.0.0")
|
|
|
|
// implementation fg.deobf("curse.maven:cloth-config-348521:5729105")
|
|
// implementation fg.deobf("curse.maven:better-combat-by-daedelus-639842:5625757")
|
|
// implementation fg.deobf("curse.maven:freecam-by-zergatul-618947:5402097")
|
|
}
|
|
|
|
tasks.named('processResources', ProcessResources).configure {
|
|
var replaceProperties = [
|
|
minecraft_version: minecraft_version,
|
|
minecraft_version_range: minecraft_version_range,
|
|
forge_version: forge_version,
|
|
forge_version_range: forge_version_range,
|
|
loader_version_range: loader_version_range,
|
|
mod_id: mod_id,
|
|
mod_name: mod_name,
|
|
mod_license: mod_license,
|
|
mod_version: mod_version,
|
|
mod_authors: mod_authors,
|
|
mod_description: mod_description,
|
|
mod_credits: mod_credits,
|
|
mod_url: mod_url,
|
|
]
|
|
|
|
inputs.properties replaceProperties
|
|
|
|
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
|
expand replaceProperties + [project: project]
|
|
}
|
|
}
|
|
|
|
tasks.named('jar', Jar).configure {
|
|
manifest {
|
|
attributes(["Specification-Title" : mod_id,
|
|
"Specification-Vendor" : mod_authors,
|
|
"Specification-Version" : "1",
|
|
"Implementation-Title" : project.name,
|
|
"Implementation-Version" : project.jar.archiveVersion,
|
|
"Implementation-Vendor" : mod_authors,
|
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
|
"MixinConfigs" : "${mod_id}.mixins.json"
|
|
])
|
|
}
|
|
|
|
finalizedBy 'reobfJar'
|
|
}
|
|
|
|
tasks.withType(Javadoc).configureEach {
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
options.addStringOption('Xdoclint:-missing', '-quiet')
|
|
options.encoding = 'UTF-8'
|
|
failOnError = false
|
|
}
|
|
|
|
tasks.register('deobfJar', Jar) {
|
|
from(sourceSets.main.output)
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
manifest {
|
|
attributes(["Specification-Title" : mod_id,
|
|
"Specification-Vendor" : mod_authors,
|
|
"Specification-Version" : "1",
|
|
"Implementation-Title" : project.name,
|
|
"Implementation-Version" : project.jar.archiveVersion,
|
|
"Implementation-Vendor" : mod_authors,
|
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
|
"MixinConfigs" : "${mod_id}.mixins.json"
|
|
])
|
|
}
|
|
dependsOn classes
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
artifact deobfJar
|
|
artifact javadocJar
|
|
artifact sourcesJar
|
|
|
|
groupId = project.group
|
|
artifactId = mod_id
|
|
version = project.version
|
|
pom {
|
|
name = mod_id
|
|
description = mod_description
|
|
url = mod_url
|
|
licenses {
|
|
license {
|
|
name = mod_license
|
|
}
|
|
}
|
|
developers {
|
|
developer {
|
|
id = "{mod_id}"
|
|
name = mod_authors
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
name = 'LTDNexus'
|
|
url = 'https://nexus.bot.leisuretimedock.top/repository/maven-releases/'
|
|
credentials {
|
|
username = System.getenv('LTDNexusUsername') ?: ''
|
|
password = System.getenv('LTDNexusPassword') ?: ''
|
|
}
|
|
}
|
|
maven {
|
|
name = 'MafuyuNexus'
|
|
url = 'https://maven.sighs.cc/repository/maven-releases/'
|
|
credentials {
|
|
username = System.getenv('MafuyuNexusUsername') ?: ''
|
|
password = System.getenv('MafuyuNexusPassword') ?: ''
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
gradle.buildFinished {
|
|
def javadocJar = file("build/libs/${mod_id}-${mod_version}-javadoc.jar")
|
|
def sourcesJar = file("build/libs/${mod_id}-${mod_version}-sources.jar")
|
|
if (javadocJar.exists()) ant.delete(file: javadocJar)
|
|
if (sourcesJar.exists()) ant.delete(file: sourcesJar)
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = 'UTF-8'
|
|
}
|