Fix sprinting<->sneaking packet order in <= 1.21.1

This commit is contained in:
FlorianMichael 2024-10-27 16:17:38 +01:00
parent 9009ba2315
commit 3b34d6349b
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -77,6 +77,20 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Shadow private boolean inSneakingPose;
@Shadow protected abstract void sendSneakingPacket();
@WrapWithCondition(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSneakingPacket()V"))
private boolean sendSneakingAfterSprinting(ClientPlayerEntity instance) {
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_21_2);
}
@Inject(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSprintingPacket()V"))
private void sendSneakingAfterSprinting(CallbackInfo ci) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
this.sendSneakingPacket();
}
}
@WrapWithCondition(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;jump()V"))
private boolean dontJumpBeforeFlying(ClientPlayerEntity instance) {
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20_5);