mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-31 18:18:04 +01:00
Fix bad idle packets in <= 1.21.1
This commit is contained in:
parent
3b34d6349b
commit
b37115fa33
@ -79,6 +79,8 @@ 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);
|
||||
@ -91,6 +93,16 @@ 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_12_1)) {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user