Skip to content

Commit d543aa6

Browse files
Merge pull request #4 from MightyKnight/master
Update to 1.21.2-1.21.4; update Gradle and adress deprecation warnings
2 parents 084e7cc + da20aae commit d543aa6

File tree

7 files changed

+49
-24
lines changed

7 files changed

+49
-24
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 {

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G
33
# Fabric Properties
44
# check these on https://modmuss50.me/fabric.html
55

6-
minecraft_version=1.21
7-
yarn_mappings=1.21+build.9
8-
loader_version=0.16.3
6+
minecraft_version=1.21.4
7+
yarn_mappings=1.21.4+build.7
8+
loader_version=0.16.9
99
# Mod Properties
10-
mod_version=1.3-1.21
10+
mod_version=1.3-1.21.4
1111
maven_group=capitalistspz
1212
archives_base_name=snowballkb
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 {

src/main/java/capitalistspz/test/mixin/EggEntityMxn.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import net.minecraft.entity.player.PlayerEntity;
77
import net.minecraft.entity.projectile.thrown.EggEntity;
88
import net.minecraft.entity.projectile.thrown.ThrownItemEntity;
9+
import net.minecraft.server.world.ServerWorld;
910
import net.minecraft.util.hit.EntityHitResult;
1011
import net.minecraft.util.math.MathHelper;
1112
import net.minecraft.world.World;
@@ -36,7 +37,11 @@ protected void onHitPlayer(EntityHitResult entityHitResult, CallbackInfo ci) {
3637
player.setVelocity(player.getVelocity().add(this.getVelocity().normalize().multiply(SnowballKB.config.eggKbMultiplier)));
3738
player.velocityModified = true;
3839
}
39-
entity.damage(this.getDamageSources().thrown(this, this.getOwner()), SnowballKB.config.eggDamage);
40+
41+
if (entity.getWorld() instanceof ServerWorld world) {
42+
entity.damage(world, this.getDamageSources().thrown(this, this.getOwner()),
43+
SnowballKB.config.eggDamage);
44+
}
4045
}
4146

4247
}

src/main/java/capitalistspz/test/mixin/SnowballEntityMxn.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import net.minecraft.entity.player.PlayerEntity;
77
import net.minecraft.entity.projectile.thrown.SnowballEntity;
88
import net.minecraft.entity.projectile.thrown.ThrownItemEntity;
9+
import net.minecraft.server.world.ServerWorld;
910
import net.minecraft.util.hit.EntityHitResult;
1011
import net.minecraft.util.math.MathHelper;
1112
import net.minecraft.world.World;
@@ -36,7 +37,11 @@ protected void onHitPlayer(EntityHitResult entityHitResult, CallbackInfo ci, Ent
3637
entity.setVelocity(entity.getVelocity().add(this.getVelocity().normalize().multiply(SnowballKB.config.snowKbMultiplier)));
3738
entity.velocityModified = true;
3839
}
39-
entity.damage(this.getDamageSources().thrown(this, this.getOwner()), SnowballKB.config.snowDamage);
40+
41+
if (entity.getWorld() instanceof ServerWorld world) {
42+
entity.damage(world, this.getDamageSources().thrown(this, this.getOwner()),
43+
SnowballKB.config.snowDamage);
44+
}
4045
}
4146

4247
}

src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"accessWidener" : "snowballkb.accesswidener",
2222
"depends": {
2323
"fabricloader": ">=0.15.11",
24-
"minecraft": ">=1.21"
24+
"minecraft": ">=1.21.2"
2525
}
2626
}

0 commit comments

Comments
 (0)