Skip to content

Commit 29cec02

Browse files
committed
- 1.21.11
- remap to official mapping
1 parent 352e006 commit 29cec02

16 files changed

Lines changed: 262 additions & 255 deletions

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '1.11-SNAPSHOT'
2+
id 'net.fabricmc.fabric-loom-remap' version "${loom_version}"
33
id 'maven-publish'
44
}
55

@@ -25,7 +25,7 @@ repositories {
2525
dependencies {
2626
// To change the versions see the gradle.properties file
2727
minecraft "com.mojang:minecraft:${project.minecraft_version}"
28-
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
28+
mappings loom.officialMojangMappings()
2929
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
3030

3131
// Fabric API. This is technically optional, but you probably want it anyway.

gradle.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ org.gradle.parallel=true
44

55
# Fabric Properties
66
# check these on https://fabricmc.net/develop
7-
minecraft_version=1.21.9
8-
yarn_mappings=1.21.9+build.1
9-
loader_version=0.17.2
7+
minecraft_version=1.21.11
8+
loader_version=0.18.2
9+
loom_version=1.14-SNAPSHOT
1010

1111
# Mod Properties
12-
mod_version=0.5.4-mc1.21.9
12+
mod_version=0.5.4-mc1.21.11
1313
maven_group=com.rimo
1414
archives_base_name=footprintparticle
1515

1616
# Dependencies
17-
fabric_version=0.133.14+1.21.9
18-
cloth_config_version=19.0.147
17+
fabric_version=0.139.4+1.21.11
18+
cloth_config_version=21.11.151
1919
#pehkui_version=3.8.3
20-
mod_menu_version=15.0.0
20+
mod_menu_version=17.0.0-alpha.1

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/java/com/rimo/footprintparticle/FPPClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
77
import net.fabricmc.api.ClientModInitializer;
88
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
9-
import net.minecraft.registry.Registries;
10-
import net.minecraft.registry.Registry;
9+
import net.minecraft.core.Registry;
10+
import net.minecraft.core.registries.BuiltInRegistries;
1111
import org.slf4j.Logger;
1212
import org.slf4j.LoggerFactory;
1313

@@ -16,10 +16,10 @@ public class FPPClient implements ClientModInitializer {
1616
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
1717
public static final FPPConfig CONFIG = AutoConfig.register(FPPConfig.class, GsonConfigSerializer::new).getConfig();
1818

19-
public static final FootprintParticleType FOOTPRINT = Registry.register(Registries.PARTICLE_TYPE, MOD_ID + ":footprint", new FootprintParticleType(true));
20-
public static final WatermarkParticleType WATERMARK = Registry.register(Registries.PARTICLE_TYPE, MOD_ID + ":watermark", new WatermarkParticleType(true));
21-
public static final SnowDustParticleType SNOWDUST = Registry.register(Registries.PARTICLE_TYPE, MOD_ID + ":snowdust", new SnowDustParticleType(true));
22-
public static final WaterSplashParticleType WATERSPLASH = Registry.register(Registries.PARTICLE_TYPE, MOD_ID + ":watersplash", new WaterSplashParticleType(true));
19+
public static final FootprintParticleType FOOTPRINT = Registry.register(BuiltInRegistries.PARTICLE_TYPE, MOD_ID + ":footprint", new FootprintParticleType(true));
20+
public static final WatermarkParticleType WATERMARK = Registry.register(BuiltInRegistries.PARTICLE_TYPE, MOD_ID + ":watermark", new WatermarkParticleType(true));
21+
public static final SnowDustParticleType SNOWDUST = Registry.register(BuiltInRegistries.PARTICLE_TYPE, MOD_ID + ":snowdust", new SnowDustParticleType(true));
22+
public static final WaterSplashParticleType WATERSPLASH = Registry.register(BuiltInRegistries.PARTICLE_TYPE, MOD_ID + ":watersplash", new WaterSplashParticleType(true));
2323

2424
public void onInitializeClient() {
2525
ParticleFactoryRegistry registry = ParticleFactoryRegistry.getInstance();

src/main/java/com/rimo/footprintparticle/Util.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package com.rimo.footprintparticle;
22

33
import net.fabricmc.fabric.api.client.particle.v1.FabricSpriteProvider;
4-
//import net.fabricmc.loader.api.FabricLoader;
5-
import net.minecraft.client.particle.SpriteProvider;
6-
import net.minecraft.client.texture.Sprite;
7-
import net.minecraft.entity.EntityType;
8-
import net.minecraft.entity.LivingEntity;
9-
//import virtuoel.pehkui.api.ScaleTypes;
4+
import net.minecraft.client.particle.SpriteSet;
5+
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
6+
import net.minecraft.world.entity.EntityType;
7+
import net.minecraft.world.entity.LivingEntity;
108

119
import java.util.Arrays;
1210
import java.util.List;
@@ -18,7 +16,7 @@ public static float getEntityScale(LivingEntity entity) {
1816
for (String str : FPPClient.CONFIG.getSizePerMob()) {
1917
String[] str2 = str.split(",");
2018
try {
21-
if (str2[0].contentEquals(EntityType.getId(entity.getType()).toString())) {
19+
if (str2[0].contentEquals(EntityType.getKey(entity.getType()).toString())) {
2220
scale *= Float.parseFloat(str2[1]);
2321
}
2422
} catch (Exception e) {
@@ -36,12 +34,12 @@ public static float getEntityScale(LivingEntity entity) {
3634
return scale;
3735
}
3836

39-
public static List<Sprite> getCustomSprites(LivingEntity entity, SpriteProvider spriteProvider, String def) {
37+
public static List<TextureAtlasSprite> getCustomSprites(LivingEntity entity, SpriteSet spriteProvider, String def) {
4038
String[] spriteNames = {def};
4139
for (String str : FPPClient.CONFIG.getCustomPrint()) {
4240
String[] str2 = str.split(",");
4341
try {
44-
if (str2[0].contentEquals(EntityType.getId(entity.getType()).toString())) {
42+
if (str2[0].contentEquals(EntityType.getKey(entity.getType()).toString())) {
4543
spriteNames = Arrays.copyOfRange(str2, 1, str2.length);
4644
break;
4745
}
@@ -52,7 +50,7 @@ public static List<Sprite> getCustomSprites(LivingEntity entity, SpriteProvider
5250
List<String> finalSpriteNames = Arrays.asList(spriteNames);
5351
return ((FabricSpriteProvider) spriteProvider).getSprites().stream().filter(sprite ->
5452
finalSpriteNames.stream().anyMatch(str ->
55-
sprite.getContents().getId().getPath().contentEquals(str)
53+
sprite.contents().name().getPath().contentEquals(str)
5654
)
5755
).toList();
5856
}

src/main/java/com/rimo/footprintparticle/config/ModMenuIntegration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
44
import com.terraformersmc.modmenu.api.ModMenuApi;
5-
import me.shedaniel.autoconfig.AutoConfig;
5+
import me.shedaniel.autoconfig.AutoConfigClient;
66

77
public class ModMenuIntegration implements ModMenuApi {
88
@Override
99
public ConfigScreenFactory<?> getModConfigScreenFactory() {
10-
return parent -> AutoConfig.getConfigScreen(FPPConfig.class, parent).get();
10+
return parent -> AutoConfigClient.getConfigScreen(FPPConfig.class, parent).get();
1111
}
1212
}

src/main/java/com/rimo/footprintparticle/mixin/AbstractBoatEntityMixin.java

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
11
package com.rimo.footprintparticle.mixin;
22

33
import com.rimo.footprintparticle.FPPClient;
4-
import net.minecraft.entity.Entity;
5-
import net.minecraft.entity.EntityType;
6-
import net.minecraft.entity.vehicle.AbstractBoatEntity;
7-
import net.minecraft.particle.ParticleTypes;
8-
import net.minecraft.util.math.MathHelper;
9-
import net.minecraft.world.World;
4+
import net.minecraft.core.particles.ParticleTypes;
5+
import net.minecraft.util.Mth;
6+
import net.minecraft.world.entity.Entity;
7+
import net.minecraft.world.entity.EntityType;
8+
import net.minecraft.world.entity.vehicle.boat.AbstractBoat;
9+
import net.minecraft.world.level.Level;
1010
import org.spongepowered.asm.mixin.Mixin;
1111
import org.spongepowered.asm.mixin.Shadow;
1212
import org.spongepowered.asm.mixin.injection.At;
1313
import org.spongepowered.asm.mixin.injection.Inject;
1414
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1515

16-
@Mixin(AbstractBoatEntity.class)
16+
@Mixin(AbstractBoat.class)
1717
public abstract class AbstractBoatEntityMixin extends Entity {
1818

19-
public AbstractBoatEntityMixin(EntityType<?> type, World world) {
19+
public AbstractBoatEntityMixin(EntityType<?> type, Level world) {
2020
super(type, world);
2121
}
2222

2323
@Shadow
24-
protected abstract boolean checkBoatInWater();
24+
protected abstract boolean checkInWater();
2525

2626
@Inject(method = "tick", at = @At("TAIL"))
2727
public void tick(CallbackInfo ci) {
2828
if (FPPClient.CONFIG.isEnableBoatTrail()) {
29-
int k = (int)(this.getVelocity().horizontalLength() * 10);
29+
int k = (int)(this.getDeltaMovement().horizontalDistance() * 10);
3030
while (Math.random() < k-- / 5f) {
3131
var i = Math.random() > 0.5f ? 1 : -1; //TODO: boat's yaw is 90 degrees more than other entity, strange.
32-
if (this.checkBoatInWater()) {
33-
this.getEntityWorld().addParticleClient( // at head
32+
if (this.checkInWater()) {
33+
this.level().addParticle( // at head
3434
ParticleTypes.RAIN,
35-
this.getX() + 1.2f * MathHelper.cos((float) Math.toRadians(this.getRotationClient().y + 90 + Math.random() * 30 * i)),
35+
this.getX() + 1.2f * Mth.cos((float) Math.toRadians(this.getRotationVector().y + 90 + Math.random() * 30 * i)),
3636
(int) this.getY() + 1f,
37-
this.getZ() + 1.2f * MathHelper.sin((float) Math.toRadians(this.getRotationClient().y + 90 + Math.random() * 30 * i)),
37+
this.getZ() + 1.2f * Mth.sin((float) Math.toRadians(this.getRotationVector().y + 90 + Math.random() * 30 * i)),
3838
0,
3939
0,
4040
0
4141
);
4242
for (int j = 0; j < 2; j++) {
43-
this.getEntityWorld().addParticleClient( // at paddle
43+
this.level().addParticle( // at paddle
4444
FPPClient.WATERSPLASH,
45-
this.getX() + i * MathHelper.cos((float) Math.toRadians(this.getRotationClient().y - 10 + Math.random() * 20)),
45+
this.getX() + i * Mth.cos((float) Math.toRadians(this.getRotationVector().y - 10 + Math.random() * 20)),
4646
(int) this.getY() + 1f,
47-
this.getZ() + i * MathHelper.sin((float) Math.toRadians(this.getRotationClient().y - 10 + Math.random() * 20)),
47+
this.getZ() + i * Mth.sin((float) Math.toRadians(this.getRotationVector().y - 10 + Math.random() * 20)),
4848
(Math.random() - 0.5f) / 4f,
49-
Math.random() * this.getVelocity().horizontalLength() / 2f,
49+
Math.random() * this.getDeltaMovement().horizontalDistance() / 2f,
5050
(Math.random() - 0.5f) / 4f
5151
);
5252
}
53-
this.getEntityWorld().addParticleClient( // at tail
53+
this.level().addParticle( // at tail
5454
ParticleTypes.BUBBLE,
55-
this.getX() - 1.2f * MathHelper.cos((float) Math.toRadians(this.getRotationClient().y + 90 + Math.random() * 30 * i)),
55+
this.getX() - 1.2f * Mth.cos((float) Math.toRadians(this.getRotationVector().y + 90 + Math.random() * 30 * i)),
5656
(int) this.getY() + 0.5f + Math.random() / 2f,
57-
this.getZ() - 1.2f * MathHelper.sin((float) Math.toRadians(this.getRotationClient().y + 90 + Math.random() * 30 * i)),
58-
this.getVelocity().getX() / 5f,
57+
this.getZ() - 1.2f * Mth.sin((float) Math.toRadians(this.getRotationVector().y + 90 + Math.random() * 30 * i)),
58+
this.getDeltaMovement().x() / 5f,
5959
Math.random() / 3f,
60-
this.getVelocity().getZ() / 5f
60+
this.getDeltaMovement().z() / 5f
6161
);
6262
} else {
6363
if (Math.random() > 0.5f) {
64-
this.getEntityWorld().addParticleClient( // at paddle
64+
this.level().addParticle( // at paddle
6565
ParticleTypes.CLOUD,
66-
this.getX() + i * MathHelper.cos((float) Math.toRadians(this.getRotationClient().y - 10 + Math.random() * 20)),
66+
this.getX() + i * Mth.cos((float) Math.toRadians(this.getRotationVector().y - 10 + Math.random() * 20)),
6767
this.getY(),
68-
this.getZ() + i * MathHelper.sin((float) Math.toRadians(this.getRotationClient().y - 10 + Math.random() * 20)),
68+
this.getZ() + i * Mth.sin((float) Math.toRadians(this.getRotationVector().y - 10 + Math.random() * 20)),
6969
Math.random() / 5f,
7070
Math.random() / 5f,
7171
Math.random() / 5f
7272
);
7373
} else {
74-
this.getEntityWorld().addParticleClient( // at tail
74+
this.level().addParticle( // at tail
7575
ParticleTypes.CLOUD,
76-
this.getX() - 1.2f * MathHelper.cos((float) Math.toRadians(this.getRotationClient().y + 90 + Math.random() * 30 * i)),
76+
this.getX() - 1.2f * Mth.cos((float) Math.toRadians(this.getRotationVector().y + 90 + Math.random() * 30 * i)),
7777
this.getY(),
78-
this.getZ() - 1.2f * MathHelper.sin((float) Math.toRadians(this.getRotationClient().y + 90 + Math.random() * 30 * i)),
79-
this.getVelocity().getX() / 5f,
78+
this.getZ() - 1.2f * Mth.sin((float) Math.toRadians(this.getRotationVector().y + 90 + Math.random() * 30 * i)),
79+
this.getDeltaMovement().x() / 5f,
8080
Math.random() / 5f,
81-
this.getVelocity().getZ() / 5f
81+
this.getDeltaMovement().z() / 5f
8282
);
8383
}
8484
}

src/main/java/com/rimo/footprintparticle/mixin/AbstractMinecartEntityMixin.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
package com.rimo.footprintparticle.mixin;
22

33
import com.rimo.footprintparticle.FPPClient;
4-
import net.minecraft.block.Blocks;
5-
import net.minecraft.entity.Entity;
6-
import net.minecraft.entity.EntityType;
7-
import net.minecraft.entity.vehicle.AbstractMinecartEntity;
8-
import net.minecraft.particle.ParticleTypes;
9-
import net.minecraft.registry.tag.BlockTags;
10-
import net.minecraft.util.math.MathHelper;
11-
import net.minecraft.world.World;
4+
import net.minecraft.core.particles.ParticleTypes;
5+
import net.minecraft.tags.BlockTags;
6+
import net.minecraft.util.Mth;
7+
import net.minecraft.world.entity.Entity;
8+
import net.minecraft.world.entity.EntityType;
9+
import net.minecraft.world.entity.vehicle.minecart.AbstractMinecart;
10+
import net.minecraft.world.level.Level;
11+
import net.minecraft.world.level.block.Blocks;
1212
import org.spongepowered.asm.mixin.Mixin;
1313
import org.spongepowered.asm.mixin.Unique;
1414
import org.spongepowered.asm.mixin.injection.At;
1515
import org.spongepowered.asm.mixin.injection.Inject;
1616
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1717

18-
@Mixin(AbstractMinecartEntity.class)
18+
@Mixin(AbstractMinecart.class)
1919
public abstract class AbstractMinecartEntityMixin extends Entity {
2020

21-
public AbstractMinecartEntityMixin(EntityType<?> type, World world) {
21+
public AbstractMinecartEntityMixin(EntityType<?> type, Level world) {
2222
super(type, world);
2323
}
2424

@@ -28,20 +28,20 @@ public AbstractMinecartEntityMixin(EntityType<?> type, World world) {
2828
//TODO: inject at TAIL will do nothing, why?
2929
@Inject(method = "tick", at = @At("HEAD"))
3030
public void tick(CallbackInfo ci) {
31-
if (timer-- <= 0 && this.getVelocity().horizontalLength() != 0) {
32-
if (this.getEntityWorld().getBlockState(this.getBlockPos()).isIn(BlockTags.RAILS) && Math.random() <= FPPClient.CONFIG.getRailFlameRange()) {
31+
if (timer-- <= 0 && this.getDeltaMovement().horizontalDistance() != 0) {
32+
if (this.level().getBlockState(this.blockPosition()).is(BlockTags.RAILS) && Math.random() <= FPPClient.CONFIG.getRailFlameRange()) {
3333
var i = Math.random() > 0.5f ? 1 : -1;
34-
this.getEntityWorld().addParticleClient(
34+
this.level().addParticle(
3535
ParticleTypes.ELECTRIC_SPARK,
36-
this.getX() + i * 0.4f * MathHelper.cos((float) Math.toRadians(this.getRotationClient().y + 90)),
36+
this.getX() + i * 0.4f * Mth.cos((float) Math.toRadians(this.getRotationVector().y + 90)),
3737
this.getY() + 0.0625f,
38-
this.getZ() + i * 0.4f * MathHelper.sin((float) Math.toRadians(this.getRotationClient().y + 90)),
39-
this.getVelocity().getX() / 3f * Math.random(),
38+
this.getZ() + i * 0.4f * Mth.sin((float) Math.toRadians(this.getRotationVector().y + 90)),
39+
this.getDeltaMovement().x() / 3f * Math.random(),
4040
Math.random() / 3,
41-
this.getVelocity().getZ() / 3f * Math.random()
41+
this.getDeltaMovement().z() / 3f * Math.random()
4242
);
4343
}
44-
timer = this.getEntityWorld().getBlockState(this.getBlockPos()).isOf(Blocks.POWERED_RAIL)?
44+
timer = this.level().getBlockState(this.blockPosition()).is(Blocks.POWERED_RAIL)?
4545
(int) (FPPClient.CONFIG.getSecPerPrint() * 3.33f):
4646
(int) (FPPClient.CONFIG.getSecPerPrint() * 6.66f);
4747
}

0 commit comments

Comments
 (0)