diff options
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol_1_12.cpp | 4 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 26 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_9.cpp | 27 |
3 files changed, 41 insertions, 16 deletions
diff --git a/src/Protocol/Protocol_1_12.cpp b/src/Protocol/Protocol_1_12.cpp index 81f81dc1c..06238e408 100644 --- a/src/Protocol/Protocol_1_12.cpp +++ b/src/Protocol/Protocol_1_12.cpp @@ -349,6 +349,10 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_ { Flags |= 0x20; } + if (a_Entity.IsElytraFlying()) + { + Flags |= 0x80; + } a_Pkt.WriteBEUInt8(ENTITY_FLAGS); // Index a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE); // Type a_Pkt.WriteBEInt8(Flags); diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index fe99ab91a..7d4dfb85d 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -2462,14 +2462,20 @@ void cProtocol_1_8_0::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Action); HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, JumpBoost); + if (PlayerID != m_Client->GetPlayer()->GetUniqueID()) + { + m_Client->Kick("Mind your own business! Hacked client?"); + return; + } + switch (Action) { - case 0: m_Client->HandleEntityCrouch(PlayerID, true); break; // Crouch - case 1: m_Client->HandleEntityCrouch(PlayerID, false); break; // Uncrouch - case 2: m_Client->HandleEntityLeaveBed(PlayerID); break; // Leave Bed - case 3: m_Client->HandleEntitySprinting(PlayerID, true); break; // Start sprinting - case 4: m_Client->HandleEntitySprinting(PlayerID, false); break; // Stop sprinting - case 6: m_Client->HandleOpenHorseInventory(PlayerID); break; // Open horse inventory + case 0: return m_Client->HandleCrouch(true); + case 1: return m_Client->HandleCrouch(false); + case 2: return m_Client->HandleLeaveBed(); + case 3: return m_Client->HandleSprint(true); + case 4: return m_Client->HandleSprint(false); + case 6: return m_Client->HandleOpenHorseInventory(); } } @@ -2535,7 +2541,7 @@ void cProtocol_1_8_0::HandlePacketPlayerPos(cByteBuffer & a_ByteBuffer) HANDLE_READ(a_ByteBuffer, ReadBEDouble, double, PosY); HANDLE_READ(a_ByteBuffer, ReadBEDouble, double, PosZ); HANDLE_READ(a_ByteBuffer, ReadBool, bool, IsOnGround); - m_Client->HandlePlayerPos(PosX, PosY, PosZ, PosY + (m_Client->GetPlayer()->IsCrouched() ? 1.54 : 1.62), IsOnGround); + m_Client->HandlePlayerPos(PosX, PosY, PosZ, IsOnGround); } @@ -2550,7 +2556,7 @@ void cProtocol_1_8_0::HandlePacketPlayerPosLook(cByteBuffer & a_ByteBuffer) HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, Yaw); HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, Pitch); HANDLE_READ(a_ByteBuffer, ReadBool, bool, IsOnGround); - m_Client->HandlePlayerMoveLook(PosX, PosY, PosZ, PosY + 1.62, Yaw, Pitch, IsOnGround); + m_Client->HandlePlayerMoveLook(PosX, PosY, PosZ, Yaw, Pitch, IsOnGround); } @@ -3355,6 +3361,10 @@ void cProtocol_1_8_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a { Flags |= 0x20; } + if (a_Entity.IsElytraFlying()) + { + Flags |= 0x80; + } a_Pkt.WriteBEUInt8(0); // Byte(0) + index 0 a_Pkt.WriteBEUInt8(Flags); diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index 0669e6a1a..0827b8f0b 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -945,14 +945,21 @@ void cProtocol_1_9_0::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Action); HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, JumpBoost); + if (PlayerID != m_Client->GetPlayer()->GetUniqueID()) + { + m_Client->Kick("Mind your own business! Hacked client?"); + return; + } + switch (Action) { - case 0: m_Client->HandleEntityCrouch(PlayerID, true); break; // Crouch - case 1: m_Client->HandleEntityCrouch(PlayerID, false); break; // Uncrouch - case 2: m_Client->HandleEntityLeaveBed(PlayerID); break; // Leave Bed - case 3: m_Client->HandleEntitySprinting(PlayerID, true); break; // Start sprinting - case 4: m_Client->HandleEntitySprinting(PlayerID, false); break; // Stop sprinting - case 7: m_Client->HandleOpenHorseInventory(PlayerID); break; // Open horse inventory + case 0: return m_Client->HandleCrouch(true); + case 1: return m_Client->HandleCrouch(false); + case 2: return m_Client->HandleLeaveBed(); + case 3: return m_Client->HandleSprint(true); + case 4: return m_Client->HandleSprint(false); + case 7: return m_Client->HandleOpenHorseInventory(); + case 8: return m_Client->HandleStartElytraFlight(); } } @@ -969,7 +976,7 @@ void cProtocol_1_9_0::HandlePacketPlayerPos(cByteBuffer & a_ByteBuffer) if (m_IsTeleportIdConfirmed) { - m_Client->HandlePlayerPos(PosX, PosY, PosZ, PosY + (m_Client->GetPlayer()->IsCrouched() ? 1.54 : 1.62), IsOnGround); + m_Client->HandlePlayerPos(PosX, PosY, PosZ, IsOnGround); } } @@ -988,7 +995,7 @@ void cProtocol_1_9_0::HandlePacketPlayerPosLook(cByteBuffer & a_ByteBuffer) if (m_IsTeleportIdConfirmed) { - m_Client->HandlePlayerMoveLook(PosX, PosY, PosZ, PosY + 1.62, Yaw, Pitch, IsOnGround); + m_Client->HandlePlayerMoveLook(PosX, PosY, PosZ, Yaw, Pitch, IsOnGround); } } @@ -1666,6 +1673,10 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a { Flags |= 0x20; } + if (a_Entity.IsElytraFlying()) + { + Flags |= 0x80; + } a_Pkt.WriteBEUInt8(0); // Index 0 a_Pkt.WriteBEUInt8(METADATA_TYPE_BYTE); // Type a_Pkt.WriteBEInt8(Flags); |