ExDeorum/build.gradle
thedarkcolour d4dc30a2c6 Compiles
2023-07-27 17:33:50 -07:00

140 lines
4.0 KiB
Groovy

plugins {
id 'idea'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'org.spongepowered.mixin' version '0.7.+'
}
version = '1.0'
group = 'team.rusty.exnihiloreborn'
base {
archivesName = 'exnihiloreborn'
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
minecraft {
mappings channel: 'parchment', version: "$parchment_mappings-$mc_version"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
copyIdeResources = true
client {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
mods {
exnihiloreborn {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run/server')
property 'forge.logging.console.level', 'debug'
mods {
exnihiloreborn {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
args '--mod', 'exnihiloreborn', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
exnihiloreborn {
source sourceSets.main
}
}
}
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
mavenCentral()
maven {
name = 'McJty maven'
url = 'https://maven.k-4u.nl'
content { includeGroup 'mcjty.theoneprobe' }
}
maven {
name = 'jei'
url = 'https://maven.blamejared.com/'
content { includeGroup "mezz.jei" }
}
maven {
name = 'ModKit'
url 'https://jitpack.io'
content { includeGroup 'com.github.thedarkcolour' }
}
}
dependencies {
minecraft("net.minecraftforge:forge:${mc_version}-${forge_version}")
// TOP
implementation(fg.deobf("mcjty.theoneprobe:theoneprobe:1.20.0-${top_version}") {
transitive = false
})
// JEI OPTIONAL
compileOnly(fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}"))
compileOnly(fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}"))
// at runtime, use the full JEI jar for Forge
runtimeOnly(fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}"))
// not required for players
implementation fg.deobf('com.github.thedarkcolour:ModKit:ea67392fd6')
}
def replaceProperties = [ mc_version: mc_version, mod_version: version ]
processResources {
inputs.properties replaceProperties
replaceProperties.put 'project', project
filesMatching(['META-INF/mods.toml']) {
expand replaceProperties
}
// Minify JSON resources
// Actual reduction in file size is just a few KB, but why not?
doLast {
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
File file ->
//noinspection UnnecessaryQualifiedReference
try {
file.text = groovy.json.JsonOutput.toJson(new groovy.json.JsonSlurper().parse(file))
} catch (Exception e) {
println "Unable to minify file ${file.name}"
throw new RuntimeException(e)
}
}
}
}
jar {
manifest {
attributes([
"Specification-Title": "exnihiloreborn",
"Specification-Vendor": "exnihilorebornsareus",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"exnihilorebornsareus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}