Skip to content

Commit a779e1c

Browse files
committed
fix(1.21.2): trying my best to keep it together 😭
1 parent 2a8247d commit a779e1c

File tree

5 files changed

+34
-32
lines changed

5 files changed

+34
-32
lines changed

build.gradle.kts

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ dependencies {
6464
"fabric-key-binding-api-v1",
6565
"fabric-lifecycle-events-v1",
6666
"fabric-networking-api-v1",
67-
"fabric-screen-api-v1", // bruh
67+
68+
"fabric-screen-api-v1",
69+
"fabric-resource-loader-v0" // until yacl is updated
6870
).map { fabricApi.module(it, property("fabric.api").toString()) }.forEach(::modImplementation)
6971

7072
modImplementation("com.terraformersmc:modmenu:${property("api.modmenu")}")
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package dev.rvbsm.fsit.mixin;
22

33
import net.minecraft.entity.Entity;
4-
import net.minecraft.entity.LivingEntity;
4+
import net.minecraft.entity.MovementType;
55
import net.minecraft.util.math.Vec3d;
66

77
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
8-
import com.llamalad7.mixinextras.sugar.Local;
98
import org.spongepowered.asm.mixin.Mixin;
109
import org.spongepowered.asm.mixin.Shadow;
1110
import org.spongepowered.asm.mixin.injection.At;
@@ -21,22 +20,12 @@ public abstract class EntityMixin {
2120
@Shadow
2221
public abstract Vec3d getPos();
2322

24-
@Inject(
25-
method = "move",
26-
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setPosition(DDD)V", ordinal = 1))
27-
protected void move(
28-
CallbackInfo ci,
29-
@Local(ordinal = 1) Vec3d velocity
30-
) {
23+
@Inject(method = "move", at = @At("TAIL"))
24+
protected void onMove(MovementType type, Vec3d movement, CallbackInfo ci) {
3125
}
3226

3327
@ModifyReturnValue(method = "hasPlayerRider", at = @At("RETURN"))
3428
protected boolean hasPlayerRider(boolean original) {
3529
return original;
3630
}
37-
38-
@ModifyReturnValue(method = "updatePassengerForDismount", at = @At("RETURN"))
39-
protected Vec3d updatePassengerForDismount(Vec3d original, @Local(argsOnly = true) LivingEntity passenger) {
40-
return original;
41-
}
4231
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
package dev.rvbsm.fsit.mixin;
22

3+
import net.minecraft.entity.Entity;
34
import net.minecraft.entity.LivingEntity;
45

56
import org.spongepowered.asm.mixin.Mixin;
7+
import org.spongepowered.asm.mixin.Shadow;
8+
import org.spongepowered.asm.mixin.injection.At;
9+
import org.spongepowered.asm.mixin.injection.Inject;
10+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
611

712
@Mixin(LivingEntity.class)
813
public abstract class LivingEntityMixin extends EntityMixin {
14+
15+
@Shadow
16+
public abstract void stopRiding();
17+
18+
@Inject(method = "onDismounted", at = @At("TAIL"))
19+
protected void onDismount(Entity vehicle, CallbackInfo ci) {
20+
}
921
}

src/main/java/dev/rvbsm/fsit/mixin/PlayerEntityMixin.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
package dev.rvbsm.fsit.mixin;
22

3+
import net.minecraft.entity.EntityPose;
34
import net.minecraft.entity.player.PlayerAbilities;
45
import net.minecraft.entity.player.PlayerEntity;
56
import net.minecraft.util.math.Vec3d;
67

7-
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
88
import org.jetbrains.annotations.NotNull;
99
import org.jetbrains.annotations.Nullable;
1010
import org.spongepowered.asm.mixin.Mixin;
1111
import org.spongepowered.asm.mixin.Shadow;
1212
import org.spongepowered.asm.mixin.Unique;
1313
import org.spongepowered.asm.mixin.injection.At;
14+
import org.spongepowered.asm.mixin.injection.ModifyArg;
1415

1516
import dev.rvbsm.fsit.api.player.PlayerPose;
1617
import dev.rvbsm.fsit.entity.ModPose;
@@ -27,11 +28,13 @@ public abstract class PlayerEntityMixin extends LivingEntityMixin implements Pla
2728
@Shadow
2829
public abstract PlayerAbilities getAbilities();
2930

30-
@ModifyExpressionValue(
31+
@ModifyArg(
3132
method = "updatePose",
32-
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isSwimming()Z"))
33-
private boolean isCrawling(boolean isSwimming) {
34-
return isSwimming || this.fsit$isInPose(ModPose.Crawling);
33+
at = @At(
34+
value = "INVOKE",
35+
target = "Lnet/minecraft/entity/player/PlayerEntity;setPose(Lnet/minecraft/entity/EntityPose;)V"))
36+
private EntityPose isCrawling(EntityPose pose) {
37+
return this.fsit$isInPose(ModPose.Crawling) ? EntityPose.SWIMMING : pose;
3538
}
3639

3740
@Override

src/main/java/dev/rvbsm/fsit/mixin/ServerPlayerEntityMixin.java

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package dev.rvbsm.fsit.mixin;
22

33
import net.minecraft.entity.Entity;
4+
import net.minecraft.entity.MovementType;
45
import net.minecraft.server.network.ServerPlayerEntity;
56
import net.minecraft.util.Util;
67
import net.minecraft.util.math.Vec3d;
78

8-
import com.llamalad7.mixinextras.sugar.Local;
99
import org.jetbrains.annotations.NotNull;
1010
import org.jetbrains.annotations.Nullable;
1111
import org.spongepowered.asm.mixin.Mixin;
12-
import org.spongepowered.asm.mixin.Shadow;
1312
import org.spongepowered.asm.mixin.Unique;
1413
import org.spongepowered.asm.mixin.injection.At;
1514
import org.spongepowered.asm.mixin.injection.Inject;
@@ -37,9 +36,6 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin implemen
3736
@Unique
3837
private long lastSneakTime = 0L;
3938

40-
@Shadow
41-
public abstract void stopRiding();
42-
4339
@Inject(method = "playerTick", at = @At("TAIL"))
4440
private void tickPosing(CallbackInfo ci) {
4541
if (this.fsit$isInPose()) {
@@ -68,16 +64,16 @@ private void copyConfig(ServerPlayerEntity oldPlayer, boolean alive, CallbackInf
6864
}
6965
}
7066

71-
@Inject(method = "stopRiding", at = @At("TAIL"))
72-
private void resetPose(CallbackInfo ci, @Local Entity entity) {
73-
if (this.fsit$isInPose(ModPose.Sitting)) {
74-
this.fsit$resetPose();
75-
}
67+
@Override
68+
protected void onMove(MovementType type, Vec3d movement, CallbackInfo ci) {
69+
this.playerVelocity = movement;
7670
}
7771

7872
@Override
79-
protected void move(CallbackInfo ci, Vec3d velocity) {
80-
this.playerVelocity = velocity;
73+
protected void onDismount(Entity vehicle, CallbackInfo ci) {
74+
if (this.fsit$isInPose(ModPose.Sitting)) {
75+
this.fsit$resetPose();
76+
}
8177
}
8278

8379
@Override

0 commit comments

Comments
 (0)