|
| 1 | +plugins { |
| 2 | + id 'fabric-loom' version '1.0-SNAPSHOT' |
| 3 | + id 'maven-publish' |
| 4 | +} |
| 5 | + |
| 6 | +sourceCompatibility = JavaVersion.VERSION_17 |
| 7 | +targetCompatibility = JavaVersion.VERSION_17 |
| 8 | + |
| 9 | +archivesBaseName = project.archives_base_name |
| 10 | +version = project.mod_version + "+mc" + project.minecraft_version |
| 11 | +group = project.maven_group |
| 12 | + |
| 13 | +loom { |
| 14 | + accessWidenerPath = file("src/main/resources/emitrades.accesswidener") |
| 15 | +} |
| 16 | + |
| 17 | +repositories { |
| 18 | + maven { |
| 19 | + name = "TerraformersMC" |
| 20 | + url = "https://maven.terraformersmc.com/" |
| 21 | + } |
| 22 | +} |
| 23 | + |
| 24 | +dependencies { |
| 25 | + // To change the versions see the gradle.properties file |
| 26 | + minecraft "com.mojang:minecraft:${project.minecraft_version}" |
| 27 | + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" |
| 28 | + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" |
| 29 | + |
| 30 | + // Fabric API. This is technically optional, but you probably want it anyway. |
| 31 | + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" |
| 32 | + |
| 33 | + modImplementation "dev.emi:emi:${project.emi_version}" |
| 34 | + |
| 35 | + // Uncomment the following line to enable the deprecated Fabric API modules. |
| 36 | + // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. |
| 37 | + |
| 38 | + // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" |
| 39 | +} |
| 40 | + |
| 41 | +processResources { |
| 42 | + inputs.property "version", project.version |
| 43 | + |
| 44 | + filesMatching("fabric.mod.json") { |
| 45 | + expand "version": project.version |
| 46 | + } |
| 47 | +} |
| 48 | + |
| 49 | +tasks.withType(JavaCompile).configureEach { |
| 50 | + // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. |
| 51 | + it.options.release = 17 |
| 52 | +} |
| 53 | + |
| 54 | +java { |
| 55 | + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task |
| 56 | + // if it is present. |
| 57 | + // If you remove this line, sources will not be generated. |
| 58 | + withSourcesJar() |
| 59 | +} |
| 60 | + |
| 61 | +jar { |
| 62 | + from("LICENSE") { |
| 63 | + rename { "${it}_${project.archivesBaseName}"} |
| 64 | + } |
| 65 | +} |
| 66 | + |
| 67 | +// configure the maven publication |
| 68 | +publishing { |
| 69 | + publications { |
| 70 | + mavenJava(MavenPublication) { |
| 71 | + from components.java |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. |
| 76 | + repositories { |
| 77 | + // Add repositories to publish to here. |
| 78 | + // Notice: This block does NOT have the same function as the block in the top level. |
| 79 | + // The repositories here will be used for publishing your artifact, not for |
| 80 | + // retrieving dependencies. |
| 81 | + } |
| 82 | +} |
0 commit comments