plugins { id 'fabric-loom' version '1.7-SNAPSHOT' id 'maven-publish' } sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 archivesBaseName = project.archives_base_name version = project.clientVersion group = project.maven_group 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. maven { name = 'Ladysnake Mods' url = 'https://maven.ladysnake.org/releases' content { includeGroup 'io.github.ladysnake' includeGroup 'org.ladysnake' includeGroupByRegex 'dev\\.onyxstudios.*' } } maven { name = "meteor-maven" url = uri("https://maven.meteordev.org/releases") } maven { name = "meteor-maven-snapshots" url = uri("https://maven.meteordev.org/snapshots") } } configurations { embed modImplementation.extendsFrom embed } def getHash() { def gitFolder = "$projectDir/.git/" def takeFromHash = 16 def head = new File(gitFolder + "HEAD").text.split(":") // .git/HEAD def isCommit = head.length == 1 if(isCommit) return head[0].trim().take(takeFromHash) def refHead = new File(gitFolder + head[1].trim()) refHead.text.trim().take takeFromHash } String hash = getHash() String watermarkVersion = project.versionWatermark loom { accessWidenerPath = file("src/main/resources/kami.accesswidener") } compileJava { String contents = "" File update = file 'src/main/java/me/skitttyy/kami/impl/KamiMod.java' contents = update.getText( 'UTF-8' ) contents = contents.replaceAll( 'HASH = "(.*?)"', 'HASH = "' + hash + '"' ) contents = contents.replaceAll( 'VERSION = "(.*?)"', 'VERSION = "' + watermarkVersion + '"' ) update.write( contents, 'UTF-8' ) } dependencies { implementation 'org.projectlombok:lombok:1.18.30' annotationProcessor 'org.projectlombok:lombok:1.18.30' // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" 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_version}" modCompileOnly("meteordevelopment:baritone:${baritone_version}-SNAPSHOT") modImplementation "org.ladysnake:satin:${satin_version}" // Include Satin as a Jar-in-Jar dependency (optional) include "org.ladysnake:satin:${satin_version}" // embed group: 'club.minnced', name: 'java-discord-rpc', version: '2.0.1' embed 'org.yaml:snakeyaml:2.0' } task getDeps(type: Copy) { from sourceSets.main.runtimeClasspath into 'runtime/' } processResources { inputs.property "version", project.clientVersion filesMatching("fabric.mod.json") { expand "version": project.clientVersion } } tasks.withType(JavaCompile).configureEach { // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. it.options.release = 17 } 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() } jar { from("LICENSE") { rename { "${it}_${project.archivesBaseName}"} } from(configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }) { exclude 'dummyThing', 'LICENSE.txt', 'META-INF/MUMFREY.RSA', 'META-INF/maven/**', 'org/**/*.html' } } // configure the maven publication publishing { publications { mavenJava(MavenPublication) { 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. } } loom { runs { // // This adds a new gradle task that runs the datagen API: "gradlew runDatagenClient" // datagenClient { inherit client name "Data Generation" vmArg "-Dfabric-api.datagen" vmArg "-Dfabric-api.datagen.output-dir=${file("src/main/generated")}" vmArg "-Dfabric-api.datagen.modid=${project.archives_base_name}" runDir "build/datagen" } } //if i make a working doublemine autocity r u gonna shut up } // // Adds the generated files into the jar you distribute to players. // sourceSets { main { resources { srcDirs += [ 'src/main/generated' ] } } }