summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_9.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-08-30 16:42:58 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-08-30 16:42:58 +0200
commitf0d14229706eca615198c888bd8d3b95b663cfb4 (patch)
treedfcb7fb092091b69a80b3b362adf862f80ba1ba0 /src/Protocol/Protocol_1_9.cpp
parentInitial zombies (diff)
parentMerge pull request #3969 from peterbell10/cuboid (diff)
downloadcuberite-f0d14229706eca615198c888bd8d3b95b663cfb4.tar
cuberite-f0d14229706eca615198c888bd8d3b95b663cfb4.tar.gz
cuberite-f0d14229706eca615198c888bd8d3b95b663cfb4.tar.bz2
cuberite-f0d14229706eca615198c888bd8d3b95b663cfb4.tar.lz
cuberite-f0d14229706eca615198c888bd8d3b95b663cfb4.tar.xz
cuberite-f0d14229706eca615198c888bd8d3b95b663cfb4.tar.zst
cuberite-f0d14229706eca615198c888bd8d3b95b663cfb4.zip
Diffstat (limited to 'src/Protocol/Protocol_1_9.cpp')
-rw-r--r--src/Protocol/Protocol_1_9.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index 7eeba06b4..5267c7a8a 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -17,7 +17,7 @@ Implements the 1.9 protocol classes:
#include "json/json.h"
#include "Protocol_1_9.h"
#include "ChunkDataSerializer.h"
-#include "PolarSSL++/Sha1Checksum.h"
+#include "mbedTLS++/Sha1Checksum.h"
#include "Packetizer.h"
#include "../ClientHandle.h"
@@ -1124,9 +1124,10 @@ void cProtocol_1_9_0::SendPlayerSpawn(const cPlayer & a_Player)
cPacketizer Pkt(*this, 0x05); // Spawn Player packet
Pkt.WriteVarInt32(a_Player.GetUniqueID());
Pkt.WriteUUID(a_Player.GetUUID());
- Pkt.WriteBEDouble(a_Player.GetPosX());
- Pkt.WriteBEDouble(a_Player.GetPosY() + 0.001); // The "+ 0.001" is there because otherwise the player falls through the block they were standing on.
- Pkt.WriteBEDouble(a_Player.GetPosZ());
+ Vector3d LastSentPos = a_Player.GetLastSentPos();
+ Pkt.WriteBEDouble(LastSentPos.x);
+ Pkt.WriteBEDouble(LastSentPos.y + 0.001); // The "+ 0.001" is there because otherwise the player falls through the block they were standing on.
+ Pkt.WriteBEDouble(LastSentPos.z);
Pkt.WriteByteAngle(a_Player.GetYaw());
Pkt.WriteByteAngle(a_Player.GetPitch());
WriteEntityMetadata(Pkt, a_Player);
@@ -1359,9 +1360,10 @@ void cProtocol_1_9_0::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock
Pkt.WriteBEUInt64(0);
Pkt.WriteBEUInt64(a_FallingBlock.GetUniqueID());
Pkt.WriteBEUInt8(70); // Falling block
- Pkt.WriteBEDouble(a_FallingBlock.GetPosX());
- Pkt.WriteBEDouble(a_FallingBlock.GetPosY());
- Pkt.WriteBEDouble(a_FallingBlock.GetPosZ());
+ Vector3d LastSentPos = a_FallingBlock.GetLastSentPos();
+ Pkt.WriteBEDouble(LastSentPos.x);
+ Pkt.WriteBEDouble(LastSentPos.y);
+ Pkt.WriteBEDouble(LastSentPos.z);
Pkt.WriteByteAngle(a_FallingBlock.GetYaw());
Pkt.WriteByteAngle(a_FallingBlock.GetPitch());
Pkt.WriteBEInt32(static_cast<Int32>(a_FallingBlock.GetBlockType()) | (static_cast<Int32>(a_FallingBlock.GetBlockMeta()) << 12));
@@ -1384,9 +1386,10 @@ void cProtocol_1_9_0::SendSpawnMob(const cMonster & a_Mob)
Pkt.WriteBEUInt64(0);
Pkt.WriteBEUInt64(a_Mob.GetUniqueID());
Pkt.WriteBEUInt8(static_cast<Byte>(a_Mob.GetMobType()));
- Pkt.WriteBEDouble(a_Mob.GetPosX());
- Pkt.WriteBEDouble(a_Mob.GetPosY());
- Pkt.WriteBEDouble(a_Mob.GetPosZ());
+ Vector3d LastSentPos = a_Mob.GetLastSentPos();
+ Pkt.WriteBEDouble(LastSentPos.x);
+ Pkt.WriteBEDouble(LastSentPos.y);
+ Pkt.WriteBEDouble(LastSentPos.z);
Pkt.WriteByteAngle(a_Mob.GetPitch());
Pkt.WriteByteAngle(a_Mob.GetHeadYaw());
Pkt.WriteByteAngle(a_Mob.GetYaw());
@@ -1443,9 +1446,10 @@ void cProtocol_1_9_0::SendSpawnVehicle(const cEntity & a_Vehicle, char a_Vehicle
Pkt.WriteBEUInt64(0);
Pkt.WriteBEUInt64(a_Vehicle.GetUniqueID());
Pkt.WriteBEUInt8(static_cast<UInt8>(a_VehicleType));
- Pkt.WriteBEDouble(a_Vehicle.GetPosX());
- Pkt.WriteBEDouble(a_Vehicle.GetPosY());
- Pkt.WriteBEDouble(a_Vehicle.GetPosZ());
+ Vector3d LastSentPos = a_Vehicle.GetLastSentPos();
+ Pkt.WriteBEDouble(LastSentPos.x);
+ Pkt.WriteBEDouble(LastSentPos.y);
+ Pkt.WriteBEDouble(LastSentPos.z);
Pkt.WriteByteAngle(a_Vehicle.GetPitch());
Pkt.WriteByteAngle(a_Vehicle.GetYaw());
Pkt.WriteBEInt32(a_VehicleSubType);