1- // file:noinspection GroovyAssignabilityCheck
2-
31plugins {
4- id ' fabric-loom' version ' 1.2 -SNAPSHOT'
2+ id ' fabric-loom' version ' 1.10 -SNAPSHOT'
53 id ' maven-publish'
64 id ' com.github.johnrengelman.shadow' version ' 8.+'
75}
86
9- sourceCompatibility = JavaVersion . VERSION_17
10- targetCompatibility = JavaVersion . VERSION_17
11-
12- archivesBaseName = project. archives_base_name
137version = project. mod_version
148group = project. maven_group
159
10+ base {
11+ archivesName = project. archives_base_name
12+ }
13+
14+ loom {
15+ splitEnvironmentSourceSets()
16+
17+ mods {
18+ redstonetools {
19+ sourceSet sourceSets. main
20+ sourceSet sourceSets. client
21+ }
22+ }
23+ }
24+
1625repositories {
1726 // Add repositories to retrieve artifacts from in here.
1827 // You should only use this when depending on other mods because
1928 // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
2029 // See https://docs.gradle.org/current/userguide/declaring_repositories.html
2130 // for more information about repositories.
31+
32+ maven { url " https://maven.shedaniel.me/" }
33+ maven { url " https://maven.terraformersmc.com/releases/" }
34+ maven { url ' https://masa.dy.fi/maven' }
35+ exclusiveContent {
36+ forRepository {
37+ maven {
38+ name = " Modrinth"
39+ url = " https://api.modrinth.com/maven"
40+ }
41+ }
42+ filter {
43+ includeGroup " maven.modrinth"
44+ }
45+ }
2246 maven {
23- name = " WorldEdit Maven"
24- url = " https://maven.enginehub.org/repo/"
25- }
47+ name = " WorldEdit Maven"
48+ url = " https://maven.enginehub.org/repo/"
49+ }
2650 maven {
2751 name = " JitPack"
2852 url = " https://jitpack.io"
2953 }
3054}
3155
3256dependencies {
33- // Doctor (dependency-injection)
34- include implementation(" rip.hippo:Doctor:1.0.1" )
3557 include implementation(" javax.inject:javax.inject:1" )
3658
3759 // Json
3860 include implementation(" javax.json:javax.json-api:1.1.4" )
39- include " org.glassfish:javax.json:1.1.4"
61+ include implementation( " org.glassfish:javax.json:1.1.4" )
4062
4163 // AutoService
4264 annotationProcessor implementation(" com.google.auto.service:auto-service:1.1.0" )
@@ -50,47 +72,62 @@ dependencies {
5072 modImplementation(" net.fabricmc.fabric-api:fabric-api:${ project.fabric_version} " )
5173
5274 // Worldedit API
53- modImplementation(" com.sk89q.worldedit:worldedit-fabric-mc1.18.2:7.2.10" )
75+ modImplementation(" com.sk89q.worldedit:worldedit-fabric-mc${ project.worldedit_version} " )
76+ // MaLiLib
77+ modApi " maven.modrinth:malilib:${ project.malilib_version} "
5478}
5579
5680processResources {
5781 inputs. property " version" , project. version
82+ inputs. property " minecraft_version" , project. minecraft_version
83+ inputs. property " minecraft_version_out" , project. minecraft_version_out
84+ inputs. property " malilib_version" , project. minecraft_version_out
85+ inputs. property " loader_version" , project. loader_version
86+ filteringCharset " UTF-8"
5887
5988 filesMatching(" fabric.mod.json" ) {
60- expand " version" : project. version
89+ expand " version" : project. version,
90+ " minecraft_version" : project. minecraft_version,
91+ " minecraft_version_out" : project. minecraft_version_out,
92+ " malilib_version" : project. minecraft_version_out,
93+ " loader_version" : project. loader_version
6194 }
6295}
6396
64- java {
65- withSourcesJar()
66- withJavadocJar()
67-
68- toolchain {
69- languageVersion = JavaLanguageVersion . of(17 )
97+ def targetJavaVersion = 21
98+ tasks. withType(JavaCompile ). configureEach {
99+ // ensure that the encoding is set to UTF-8, no matter what the system default is
100+ // this fixes some edge cases with special characters not displaying correctly
101+ // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
102+ // If Javadoc is generated, this must be specified in that task too.
103+ it. options. encoding = " UTF-8"
104+ if (targetJavaVersion >= 10 || JavaVersion . current(). isJava10Compatible()) {
105+ it. options. release. set(targetJavaVersion)
70106 }
71107}
72108
73- shadowJar {
74- archiveClassifier. set(" unmapped" )
75-
76- configurations = [project. configurations. shadow]
77-
78- from(" LICENSE" )
79- }
80-
81- remapJar {
82- inputFile = shadowJar. archiveFile
109+ java {
110+ def javaVersion = JavaVersion . toVersion(targetJavaVersion)
111+ if (JavaVersion . current() < javaVersion) {
112+ toolchain. languageVersion = JavaLanguageVersion . of(targetJavaVersion)
113+ }
114+ // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
115+ // if it is present.
116+ // If you remove this line, sources will not be generated.
117+ withSourcesJar()
83118}
84119
85- tasks. withType(JavaCompile ). configureEach {
86- // Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
87- it. options. release. set(17 )
120+ jar {
121+ from(" LICENSE" ) {
122+ rename { " ${ it} _${ project.archivesBaseName} " }
123+ }
88124}
89125
90126// configure the maven publication
91127publishing {
92128 publications {
93- mavenJava(MavenPublication ) {
129+ create(" mavenJava" , MavenPublication ) {
130+ artifactId = project. archives_base_name
94131 from components. java
95132 }
96133 }
0 commit comments