Change sprinting conditions in <= 1.21.3

This commit is contained in:
FlorianMichael 2024-12-04 15:55:20 +01:00
parent ab86e95d5e
commit 31ed7f9607
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -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);