2 id 'fabric-loom' version '0.8-SNAPSHOT'
6 sourceCompatibility = JavaVersion.VERSION_16
7 targetCompatibility = JavaVersion.VERSION_16
9 archivesBaseName = project.archives_base_name
10 version = project.mod_version
13 // Add repositories to retrieve artifacts from in here.
14 // You should only use this when depending on other mods because
15 // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
16 // See https://docs.gradle.org/current/userguide/declaring_repositories.html
17 // for more information about repositories.
21 // To change the versions see the gradle.properties file
22 minecraft "com.mojang:minecraft:${project.minecraft_version}"
23 mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
24 modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
26 // Fabric API. This is technically optional, but you probably want it anyway.
27 modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
29 // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
30 // You may need to force-disable transitiveness on them.
34 inputs.property "version", project.version
36 filesMatching("fabric.mod.json") {
37 expand "version": project.version
41 tasks.withType(JavaCompile).configureEach {
42 // ensure that the encoding is set to UTF-8, no matter what the system default is
43 // this fixes some edge cases with special characters not displaying correctly
44 // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
45 // If Javadoc is generated, this must be specified in that task too.
46 it.options.encoding = "UTF-8"
47 // If Javadoc is generated, this must be specified in that task too.
48 it.options.encoding = "UTF-8"
50 // Minecraft 1.17 (21w19a) upwards uses Java 16.
51 it.options.release = 16
55 // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
57 // If you remove this line, sources will not be generated.
63 rename { "${it}_${project.archivesBaseName}"}
67 // configure the maven publication
70 mavenJava(MavenPublication) {
71 // add all the jars that should be included when publishing to maven
75 artifact(sourcesJar) {
76 builtBy remapSourcesJar
81 // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
83 // Add repositories to publish to here.
84 // Notice: This block does NOT have the same function as the block in the top level.
85 // The repositories here will be used for publishing your artifact, not for
86 // retrieving dependencies.