Files
gravestone-sable-compat/build.gradle

133 lines
3.7 KiB
Groovy

plugins {
id 'java-library'
id 'net.neoforged.moddev' version '2.0.74'
}
version = mod_version
group = mod_group_id
base {
archivesName = mod_id
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
repositories {
mavenCentral()
// Sable Companion (lightweight shim — works whether Sable is installed or not).
exclusiveContent {
forRepository {
maven {
name = 'RyanHCode Maven'
url = 'https://maven.ryanhcode.dev/releases'
}
}
filter {
includeGroup 'dev.ryanhcode.sable'
includeGroup 'dev.ryanhcode.sable-companion'
}
}
// Modrinth maven (used for gravestone-mod jar to compile against).
exclusiveContent {
forRepository {
maven {
name = 'Modrinth'
url = 'https://api.modrinth.com/maven'
}
}
filter {
includeGroup 'maven.modrinth'
}
}
}
neoForge {
version = neoforge_version
parchment {
mappingsVersion = parchment_version
minecraftVersion = parchment_minecraft
}
validateAccessTransformers = true
runs {
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
logLevel = org.slf4j.event.Level.DEBUG
}
client {
client()
}
server {
server()
programArgument '--nogui'
}
}
mods {
"${mod_id}" {
sourceSet sourceSets.main
}
}
}
configurations {
runtimeClasspath.extendsFrom localRuntime
}
dependencies {
// Sable Companion: includes a default no-op implementation so this jar runs even
// when Sable itself is absent. Bundle it via jarJar so users only need our jar +
// Sable + Gravestone in their mods folder.
jarJar(implementation("dev.ryanhcode.sable-companion:sable-companion-common-${minecraft_version}:[${sable_companion_version},)")) {
version {
prefer sable_companion_version
}
}
// Gravestone Mod — compile against the published jar from Modrinth.
// The shadowed jar contains relocated classes under de.maxhenkel.gravestone.*
// We only reference de.maxhenkel.gravestone.events.DeathEvents (target) and
// de.maxhenkel.gravestone.GraveUtils (referenced in @At target descriptor).
compileOnly "maven.modrinth:gravestone-mod:${gravestone_version}"
// Optional fallback if the modrinth jar can't be resolved: drop a gravestone JAR
// into a 'libs/' folder in this project root, then uncomment the next line.
// compileOnly fileTree(dir: 'libs', include: ['*.jar'])
}
tasks.withType(ProcessResources).configureEach {
var replaceProperties = [
minecraft_version: minecraft_version,
minecraft_version_range: minecraft_version_range,
neoforge_version: neoforge_version,
neoforge_loader_version_range: neoforge_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/neoforge.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' : mod_name,
'Implementation-Version' : mod_version,
'Implementation-Vendor' : mod_authors,
])
}
}