summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_9.cpp
diff options
context:
space:
mode:
authorDarkoGNU <42816979+DarkoGNU@users.noreply.github.com>2022-04-26 00:16:40 +0200
committerGitHub <noreply@github.com>2022-04-26 00:16:40 +0200
commit3c75377ce679094dfe55ee9aa872dabffd2ba3f0 (patch)
tree54b9b3e7c219ec0ec17cba9cd652f76bd69e82c6 /src/Protocol/Protocol_1_9.cpp
parentMoved comment to top (diff)
downloadcuberite-3c75377ce679094dfe55ee9aa872dabffd2ba3f0.tar
cuberite-3c75377ce679094dfe55ee9aa872dabffd2ba3f0.tar.gz
cuberite-3c75377ce679094dfe55ee9aa872dabffd2ba3f0.tar.bz2
cuberite-3c75377ce679094dfe55ee9aa872dabffd2ba3f0.tar.lz
cuberite-3c75377ce679094dfe55ee9aa872dabffd2ba3f0.tar.xz
cuberite-3c75377ce679094dfe55ee9aa872dabffd2ba3f0.tar.zst
cuberite-3c75377ce679094dfe55ee9aa872dabffd2ba3f0.zip
Diffstat (limited to '')
-rw-r--r--src/Protocol/Protocol_1_9.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index 07ab4caf7..dd2133f77 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -466,18 +466,28 @@ void cProtocol_1_9_0::SendMapData(const cMap & a_Map, int a_DataStartX, int a_Da
-void cProtocol_1_9_0::SendPlayerMoveLook(void)
+void cProtocol_1_9_0::SendPlayerMoveLook (const Vector3d a_Pos, const float a_Yaw, const float a_Pitch, const bool a_IsRelative)
{
ASSERT(m_State == 3); // In game mode?
cPacketizer Pkt(*this, pktPlayerMoveLook);
- cPlayer * Player = m_Client->GetPlayer();
- Pkt.WriteBEDouble(Player->GetPosX());
- Pkt.WriteBEDouble(Player->GetPosY());
- Pkt.WriteBEDouble(Player->GetPosZ());
- Pkt.WriteBEFloat(static_cast<float>(Player->GetYaw()));
- Pkt.WriteBEFloat(static_cast<float>(Player->GetPitch()));
- Pkt.WriteBEUInt8(0);
+ Pkt.WriteBEDouble(a_Pos.x);
+ Pkt.WriteBEDouble(a_Pos.y);
+ Pkt.WriteBEDouble(a_Pos.z);
+ Pkt.WriteBEFloat(a_Yaw);
+ Pkt.WriteBEFloat(a_Pitch);
+
+ if (a_IsRelative)
+ {
+ // Set all bits to 1 - makes everything relative
+ Pkt.WriteBEUInt8(static_cast<UInt8>(-1));
+ }
+ else
+ {
+ // Set all bits to 0 - make everything absolute
+ Pkt.WriteBEUInt8(0);
+ }
+
Pkt.WriteVarInt32(++m_OutstandingTeleportId);
// This teleport ID hasn't been confirmed yet
@@ -488,6 +498,16 @@ void cProtocol_1_9_0::SendPlayerMoveLook(void)
+void cProtocol_1_9_0::SendPlayerMoveLook(void)
+{
+ cPlayer * Player = m_Client->GetPlayer();
+ SendPlayerMoveLook(Player->GetPosition(), static_cast<float>(Player->GetYaw()), static_cast<float>(Player->GetPitch()), false);
+}
+
+
+
+
+
void cProtocol_1_9_0::SendPlayerPermissionLevel()
{
const cPlayer & Player = *m_Client->GetPlayer();