diff options
author | Damián Imrich <damian@haze.sk> | 2021-04-03 19:45:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-03 19:45:20 +0200 |
commit | 071b7be3d4d08c337c01de7abca034e6c3746194 (patch) | |
tree | b878b6df8abe69493d61098610738edb8d95a82b /src/Protocol/Protocol_1_9.cpp | |
parent | Fix finisher generating invalid pumpkin (diff) | |
download | cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar.gz cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar.bz2 cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar.lz cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar.xz cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.tar.zst cuberite-071b7be3d4d08c337c01de7abca034e6c3746194.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol_1_9.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
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); |