From 31ed7f9607b0d6f17dfda44e31d2baad80039367 Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Wed, 4 Dec 2024 15:55:20 +0100 Subject: [PATCH] Change sprinting conditions in <= 1.21.3 --- .../minecraft/entity/MixinClientPlayerEntity.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java index 8eb58415..7bed766f 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinClientPlayerEntity.java @@ -87,6 +87,16 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity super(world, profile); } + @WrapWithCondition(method = "canStartSprinting", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;shouldSlowDown()Z")) + private boolean removeSlowdownCondition(ClientPlayerEntity instance) { + return instance.shouldSlowDown() && ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_21_4); + } + + @WrapWithCondition(method = "canStartSprinting", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSubmergedInWater()Z")) + private boolean removeSlowdownCondition2(ClientPlayerEntity instance) { + return instance.isSubmergedInWater() && ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_21_4); + } + @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;shouldStopSprinting()Z")) private boolean dontUnsprint(ClientPlayerEntity instance) { return shouldStopSprinting() && ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_21_4);