first test

This commit is contained in:
2026-01-08 23:51:21 +01:00
parent 156b8f17e3
commit 45e0df8b9e

View File

@@ -1,90 +1,106 @@
plugins {
id 'net.fabricmc.fabric-loom-remap' version "${loom_version}"
id 'dev.kikugie.stonecutter'
id 'maven-publish'
}
version = project.mod_version
group = project.maven_group
def modId = property('mod.id')
def modName = property('mod.name')
def modVersion = property('mod.version')
def modGroup = property('mod.group')
def modDescription = property('mod.description')
def modLicense = property('mod.license')
def modAuthor = property('mod.author')
def javaVersion = Integer.parseInt(property('java_version'))
def fabricLoaderVersion = property('deps.fabric_loader')
version = "${modVersion}+${stonecutter.current.version}"
group = modGroup
base {
archivesName = project.archives_base_name
archivesName = modId
}
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
// Loom provides Minecraft, mappings, and Fabric repositories.
}
loom {
splitEnvironmentSourceSets()
mods {
"template-mod" {
"${modId}" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
if (stonecutter.current.isActive) {
runConfigs.all {
ideConfigGenerated = true
runDir "../../run"
}
}
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
minecraft "com.mojang:minecraft:${stonecutter.current.version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
modImplementation "net.fabricmc:fabric-loader:${property('deps.fabric_loader')}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${property('deps.fabric_api')}"
}
processResources {
inputs.property "version", project.version
inputs.property "mod_id", modId
inputs.property "mod_name", modName
inputs.property "mod_description", modDescription
inputs.property "mod_license", modLicense
inputs.property "mod_author", modAuthor
inputs.property "minecraft_version", stonecutter.current.version
inputs.property "fabric_loader_version", fabricLoaderVersion
filesMatching("fabric.mod.json") {
expand "version": inputs.properties.version
expand(
version: project.version,
mod_id: modId,
mod_name: modName,
mod_description: modDescription,
mod_license: modLicense,
mod_author: modAuthor,
minecraft_version: stonecutter.current.version,
fabric_loader_version: fabricLoaderVersion
)
}
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 21
options.release = javaVersion
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.toVersion(javaVersion)
targetCompatibility = JavaVersion.toVersion(javaVersion)
}
jar {
inputs.property "archivesName", project.base.archivesName
from("LICENSE") {
rename { "${it}_${inputs.properties.archivesName}"}
rename { "${it}_${inputs.properties.archivesName}" }
}
}
// configure the maven publication
publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
artifactId = project.base.archivesName.get()
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
// Configure publishing repositories here if needed.
}
}
}