From 21033086187bfb535200a04c2d1bcb867f9195db Mon Sep 17 00:00:00 2001 From: mathiascode Date: Sun, 13 Dec 2020 21:21:50 +0200 Subject: [PATCH] Ignore CanFly flag sent by the client --- src/ClientHandle.cpp | 3 +-- src/ClientHandle.h | 2 +- src/Protocol/Protocol_1_8.cpp | 8 ++------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 88746f273..cee35203e 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -837,12 +837,11 @@ void cClientHandle::HandleEnchantItem(UInt8 a_WindowID, UInt8 a_Enchantment) -void cClientHandle::HandlePlayerAbilities(bool a_CanFly, bool a_IsFlying, float FlyingSpeed, float WalkingSpeed) +void cClientHandle::HandlePlayerAbilities(bool a_IsFlying, float FlyingSpeed, float WalkingSpeed) { UNUSED(FlyingSpeed); // Ignore the client values for these UNUSED(WalkingSpeed); - m_Player->SetCanFly(a_CanFly); m_Player->SetFlying(a_IsFlying); } diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 33a9a8f8c..fcad949f4 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -350,7 +350,7 @@ public: // tolua_export void HandleOpenHorseInventory(UInt32 a_EntityID); void HandlePing (void); - void HandlePlayerAbilities (bool a_CanFly, bool a_IsFlying, float FlyingSpeed, float WalkingSpeed); + void HandlePlayerAbilities (bool a_IsFlying, float FlyingSpeed, float WalkingSpeed); void HandlePlayerLook (float a_Rotation, float a_Pitch, bool a_IsOnGround); void HandlePlayerMoveLook (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, float a_Rotation, float a_Pitch, bool a_IsOnGround); // While m_bPositionConfirmed (normal gameplay) diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index 49418b475..d9d18b41a 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -2641,17 +2641,13 @@ void cProtocol_1_8_0::HandlePacketPlayerAbilities(cByteBuffer & a_ByteBuffer) HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, WalkingSpeed); // COnvert the bitfield into individual boolean flags: - bool IsFlying = false, CanFly = false; + bool IsFlying = false; if ((Flags & 2) != 0) { IsFlying = true; } - if ((Flags & 4) != 0) - { - CanFly = true; - } - m_Client->HandlePlayerAbilities(CanFly, IsFlying, FlyingSpeed, WalkingSpeed); + m_Client->HandlePlayerAbilities(IsFlying, FlyingSpeed, WalkingSpeed); }