11plugins {
2- id ' fabric-loom' version ' 1.6 -SNAPSHOT'
2+ id ' fabric-loom' version ' 1.9 -SNAPSHOT'
33 id ' maven-publish'
44}
55
6- sourceCompatibility = JavaVersion . VERSION_21
7- targetCompatibility = JavaVersion . VERSION_21
8-
9- archivesBaseName = project. archives_base_name
106version = project. mod_version
117group = project. maven_group
128
9+ base {
10+ archivesName = project. archives_base_name
11+ }
12+
1313repositories {
1414 // Add repositories to retrieve artifacts from in here.
1515 // You should only use this when depending on other mods because
@@ -18,6 +18,18 @@ repositories {
1818 // for more information about repositories.
1919}
2020
21+ loom {
22+ splitEnvironmentSourceSets()
23+
24+ mods {
25+ " modid" {
26+ sourceSet sourceSets. main
27+ sourceSet sourceSets. client
28+ }
29+ }
30+
31+ }
32+
2133dependencies {
2234 minecraft " com.mojang:minecraft:${ project.minecraft_version} "
2335 mappings " net.fabricmc:yarn:${ project.yarn_mappings} :v2"
@@ -30,20 +42,21 @@ processResources {
3042 filesMatching(" fabric.mod.json" ) {
3143 expand " version" : project. version
3244 }
33-
3445}
35- // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
36- // if it is present.
37- // If you remove this task, sources will not be generated.
46+
3847tasks. withType(JavaCompile ). configureEach {
3948 // Minecraft 1.20.5 upwards uses Java 21.
4049 it. options. release = 21
4150}
51+
4252java {
4353 // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
4454 // if it is present.
4555 // If you remove this line, sources will not be generated.
4656 withSourcesJar()
57+
58+ sourceCompatibility = JavaVersion . VERSION_21
59+ targetCompatibility = JavaVersion . VERSION_21
4760}
4861
4962loom {
@@ -52,17 +65,18 @@ loom {
5265
5366jar {
5467 from(" LICENSE" ) {
55- rename { " ${ it} _${ project.archivesBaseName } " }
68+ rename { " ${ it} _${ project.base.archivesName.get() } " }
5669 }
5770}
5871
5972// configure the maven publication
6073publishing {
61- publications {
62- mavenJava(MavenPublication ) {
63- from components. java
64- }
65- }
74+ publications {
75+ create(" mavenJava" , MavenPublication ) {
76+ artifactId = project. archives_base_name
77+ from components. java
78+ }
79+ }
6680
6781 // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
6882 repositories {
0 commit comments