176 lines
5.5 KiB
Groovy
176 lines
5.5 KiB
Groovy
plugins {
|
|
id 'eclipse'
|
|
id 'idea'
|
|
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
|
id 'org.spongepowered.mixin' version '0.7.+'
|
|
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
|
}
|
|
|
|
def getGitCommitHash() {
|
|
def stdout = new ByteArrayOutputStream()
|
|
exec {
|
|
commandLine 'git', 'rev-parse', '--short', 'HEAD'
|
|
standardOutput = stdout
|
|
}
|
|
return stdout.toString().trim()
|
|
}
|
|
|
|
version = "${mod_version}-SNAPSHOT-${getGitCommitHash()}"
|
|
group = 'com.atsushio.superbwarfare'
|
|
|
|
base {
|
|
archivesName = mod_id
|
|
}
|
|
|
|
java {
|
|
toolchain.languageVersion = JavaLanguageVersion.of(17)
|
|
}
|
|
|
|
minecraft {
|
|
mappings channel: 'parchment', version: '2023.08.13-1.20.1'
|
|
|
|
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
|
|
|
copyIdeResources = true
|
|
|
|
runs {
|
|
configureEach {
|
|
workingDirectory project.file('run')
|
|
|
|
property 'forge.logging.markers', 'REGISTRIES'
|
|
property 'forge.logging.console.level', 'info'
|
|
|
|
property 'geckolib.disable_examples', 'true'
|
|
|
|
mods {
|
|
"${mod_id}" {
|
|
source sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
|
|
client {
|
|
property 'forge.enabledGameTestNamespaces', mod_id
|
|
property 'mixin.env.remapRefMap', 'true'
|
|
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
|
property 'geckolib.disable_examples', 'true'
|
|
}
|
|
|
|
server {
|
|
property 'forge.enabledGameTestNamespaces', mod_id
|
|
property 'mixin.env.remapRefMap', 'true'
|
|
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
|
}
|
|
|
|
data {
|
|
property 'mixin.env.remapRefMap', 'true'
|
|
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
|
|
|
args '--mod', 'superbwarfare', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
|
}
|
|
}
|
|
}
|
|
|
|
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
|
|
|
repositories {
|
|
maven {
|
|
url = "https://maven.theillusivec4.top/"
|
|
}
|
|
maven {
|
|
url = 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/'
|
|
}
|
|
maven {
|
|
name = "Jared's maven"
|
|
url = "https://maven.blamejared.com/"
|
|
}
|
|
maven {
|
|
url "https://maven.shedaniel.me/"
|
|
}
|
|
maven {
|
|
url "https://cursemaven.com"
|
|
content {
|
|
includeGroup "curse.maven"
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
minecraft 'net.minecraftforge:forge:1.20.1-47.2.0'
|
|
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
|
|
|
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:5.4.2+1.20.1")
|
|
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:5.4.2+1.20.1:api")
|
|
|
|
implementation fg.deobf('software.bernie.geckolib:geckolib-forge-1.20.1:4.4.6')
|
|
|
|
// 可选mod依赖
|
|
|
|
// JEI相关
|
|
// compile against the JEI API but do not include it at runtime
|
|
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"))
|
|
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}"))
|
|
// at runtime, use the full JEI jar for Forge
|
|
runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}"))
|
|
|
|
// Cloth Config相关
|
|
implementation fg.deobf("me.shedaniel.cloth:cloth-config-forge:${cloth_config_version}")
|
|
|
|
// Jade相关
|
|
implementation fg.deobf("curse.maven:jade-324717:${jade_version}")
|
|
|
|
// 测试用mod
|
|
implementation fg.deobf("curse.maven:oculus-581495:6020952")
|
|
implementation fg.deobf("curse.maven:embeddium-908741:5681725")
|
|
implementation fg.deobf("curse.maven:timeless-and-classics-zero-1028108:6069384")
|
|
implementation fg.deobf("curse.maven:create-328085:5838779")
|
|
}
|
|
|
|
mixin {
|
|
add sourceSets.main, 'mixins.superbwarfare.refmap.json'
|
|
|
|
config 'mixins.superbwarfare.json'
|
|
|
|
debug.verbose = true
|
|
debug.export = true
|
|
dumpTargetOnFailure = true
|
|
|
|
quiet
|
|
}
|
|
|
|
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,
|
|
]
|
|
|
|
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", // We are version 1 of ourselves
|
|
"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")
|
|
])
|
|
}
|
|
|
|
// This is the preferred method to reobfuscate your jar file
|
|
finalizedBy 'reobfJar'
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
|
}
|