summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_8.cpp
diff options
context:
space:
mode:
authorDamián Imrich <damian@haze.sk>2021-04-03 19:45:20 +0200
committerGitHub <noreply@github.com>2021-04-03 19:45:20 +0200
commit071b7be3d4d08c337c01de7abca034e6c3746194 (patch)
treeb878b6df8abe69493d61098610738edb8d95a82b /src/Protocol/Protocol_1_8.cpp
parentFix finisher generating invalid pumpkin (diff)
downloadcuberite-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 'src/Protocol/Protocol_1_8.cpp')
-rw-r--r--src/Protocol/Protocol_1_8.cpp26
1 files changed, 18 insertions, 8 deletions
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);