Files
gravestone-sable-compat/build.gradle

146 lines
4.6 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'
}
}
// Curse Maven — used to fetch gravestone-mod by CurseForge file ID. The Modrinth
// maven was the obvious choice but it doesn't reliably serve POMs for gravestone
// 1.21.1 builds, which makes Gradle resolution fail with a 404. Curse Maven serves
// both the JAR and (synthesized) POM, so it just works.
exclusiveContent {
forRepository {
maven {
name = 'Curse Maven'
url = 'https://cursemaven.com'
}
}
filter {
includeGroup 'curse.maven'
}
}
}
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 via Curse Maven. The string format is:
// curse.maven:<slug>-<projectId>:<fileId>
// - <slug> = "gravestone-mod" (CurseForge URL slug)
// - <projectId> = 238551 (gravestone's CurseForge project ID — fixed for the project)
// - <fileId> = the specific build's CurseForge file ID (changes per release)
//
// The default fileId 7099728 is the 1.21.1-1.0.19 NeoForge build, the same one
// used by the Corpse-Gravestone-Curios-Compat reference mod for 1.21.1. To use a
// newer 1.21.1 build, look it up at
// https://www.curseforge.com/minecraft/mc-mods/gravestone-mod/files (filter to 1.21.1)
// and copy the numeric ID from the file's URL into the gravestone_curse_file_id
// property in gradle.properties. The mixin will keep working as long as gravestone
// doesn't refactor DeathEvents.playerDeath's signature (stable through 1.0.37).
compileOnly "curse.maven:gravestone-mod-238551:${gravestone_curse_file_id}"
// Optional fallback if Curse Maven is unreachable from your network: drop a
// gravestone JAR into a 'libs/' folder at the project root, comment out the
// compileOnly above, and uncomment this:
// 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,
])
}
}