11plugins {
2- id ' fabric-loom' version ' 0.7 -SNAPSHOT'
2+ id ' fabric-loom' version ' 0.11 -SNAPSHOT'
33 id ' maven-publish'
44}
55
6- sourceCompatibility = JavaVersion . VERSION_1_8
7- targetCompatibility = JavaVersion . VERSION_1_8
6+ sourceCompatibility = JavaVersion . VERSION_17
7+ targetCompatibility = JavaVersion . VERSION_17
88
99archivesBaseName = project. archives_base_name
1010version = project. mod_version
1111group = project. maven_group
1212
1313repositories {
14+ // Add repositories to retrieve artifacts from in here.
15+ // You should only use this when depending on other mods because
16+ // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
17+ // See https://docs.gradle.org/current/userguide/declaring_repositories.html
18+ // for more information about repositories.
1419 maven { url " https://maven.shedaniel.me/" }
1520}
1621
@@ -23,40 +28,31 @@ dependencies {
2328 // Fabric API. This is technically optional, but you probably want it anyway.
2429 modImplementation " net.fabricmc.fabric-api:fabric-api:${ project.fabric_version} "
2530
26- modApi(" me.shedaniel.cloth:cloth-config-fabric:4.11.19" ) {
31+ include " me.shedaniel.cloth:cloth-config-fabric:${ project.cloth_version} "
32+ modApi(" me.shedaniel.cloth:cloth-config-fabric:${ project.cloth_version} " ) {
2733 exclude(group : " net.fabricmc.fabric-api" )
2834 }
2935
30- // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
31- // You may need to force-disable transitiveness on them.
3236}
3337
3438processResources {
3539 inputs. property " version" , project. version
3640
37- from(sourceSets. main. resources. srcDirs) {
38- include " fabric.mod.json"
41+ filesMatching(" fabric.mod.json" ) {
3942 expand " version" : project. version
4043 }
41-
42- from(sourceSets. main. resources. srcDirs) {
43- exclude " fabric.mod.json"
44- }
4544}
4645
47- // ensure that the encoding is set to UTF-8, no matter what the system default is
48- // this fixes some edge cases with special characters not displaying correctly
49- // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
50- tasks. withType(JavaCompile ) {
51- options. encoding = " UTF-8"
46+ tasks. withType(JavaCompile ). configureEach {
47+ // Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
48+ it. options. release = 17
5249}
5350
54- // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
55- // if it is present.
56- // If you remove this task, sources will not be generated.
57- task sourcesJar (type : Jar , dependsOn : classes) {
58- classifier = " sources"
59- from sourceSets. main. allSource
51+ java {
52+ // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
53+ // if it is present.
54+ // If you remove this line, sources will not be generated.
55+ withSourcesJar()
6056}
6157
6258jar {
@@ -67,19 +63,15 @@ jar {
6763publishing {
6864 publications {
6965 mavenJava(MavenPublication ) {
70- // add all the jars that should be included when publishing to maven
71- artifact(remapJar) {
72- builtBy remapJar
73- }
74- artifact(sourcesJar) {
75- builtBy remapSourcesJar
76- }
66+ from components. java
7767 }
7868 }
7969
80- // select the repositories you want to publish to
70+ // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
8171 repositories {
82- // uncomment to publish to the local maven
83- // mavenLocal()
72+ // Add repositories to publish to here.
73+ // Notice: This block does NOT have the same function as the block in the top level.
74+ // The repositories here will be used for publishing your artifact, not for
75+ // retrieving dependencies.
8476 }
8577}
0 commit comments