Move idle packet fix to VV

This commit is contained in:
FlorianMichael 2024-10-31 12:46:34 +01:00
parent 141c1b00ef
commit 004579125a
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -84,9 +84,6 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
@Shadow
protected abstract void sendSneakingPacket();
@Shadow
private boolean lastHorizontalCollision;
@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);
@ -99,16 +96,6 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
}
}
@Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;lastHorizontalCollision:Z", ordinal = 0))
private boolean removeHorizontalCollisionFromOnGroundCheck(ClientPlayerEntity instance) {
// Since it doesn't exist in older versions, we need to exclude it from the check to prevent bad packets
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
return this.horizontalCollision;
} else {
return this.lastHorizontalCollision;
}
}
@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);