Skip to content

Commit da20aae

Browse files
committed
Update Gradle and Loom; resolve deprecations
1 parent 5a8e45d commit da20aae

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

build.gradle

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
plugins {
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
106
version = project.mod_version
117
group = project.maven_group
128

9+
base {
10+
archivesName = project.archives_base_name
11+
}
12+
1313
repositories {
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+
2133
dependencies {
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+
3847
tasks.withType(JavaCompile).configureEach {
3948
// Minecraft 1.20.5 upwards uses Java 21.
4049
it.options.release = 21
4150
}
51+
4252
java {
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

4962
loom {
@@ -52,17 +65,18 @@ loom {
5265

5366
jar {
5467
from("LICENSE") {
55-
rename { "${it}_${project.archivesBaseName}"}
68+
rename { "${it}_${project.base.archivesName.get()}"}
5669
}
5770
}
5871

5972
// configure the maven publication
6073
publishing {
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 {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/capitalistspz/test/config/Config.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import capitalistspz.test.SnowballKB;
44
import com.google.gson.Gson;
55
import com.google.gson.GsonBuilder;
6+
import com.google.gson.Strictness;
67
import org.apache.logging.log4j.Level;
78

89
import java.io.File;
@@ -20,7 +21,7 @@ public class Config{
2021
public float fishingRodPullMultiplier = 0.1f;
2122

2223
private static final File configFile = new File("config" + File.separator + "snowballkb.json");
23-
private static final Gson gson = new GsonBuilder().setPrettyPrinting().setLenient().create();
24+
private static final Gson gson = new GsonBuilder().setPrettyPrinting().setStrictness(Strictness.LENIENT).create();
2425

2526
public static boolean save(Config config) {
2627
try {

0 commit comments

Comments
 (0)