diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-10-03 14:29:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-03 14:29:44 +0200 |
commit | 8b0d0e96c3e7fd66c8e31e45bcccb43a78f8491b (patch) | |
tree | 91b7f4784fb7690ee6382262ced0e7e5a824a758 | |
parent | Perform bed checks upon respawn (#5300) (diff) | |
download | cuberite-8b0d0e96c3e7fd66c8e31e45bcccb43a78f8491b.tar cuberite-8b0d0e96c3e7fd66c8e31e45bcccb43a78f8491b.tar.gz cuberite-8b0d0e96c3e7fd66c8e31e45bcccb43a78f8491b.tar.bz2 cuberite-8b0d0e96c3e7fd66c8e31e45bcccb43a78f8491b.tar.lz cuberite-8b0d0e96c3e7fd66c8e31e45bcccb43a78f8491b.tar.xz cuberite-8b0d0e96c3e7fd66c8e31e45bcccb43a78f8491b.tar.zst cuberite-8b0d0e96c3e7fd66c8e31e45bcccb43a78f8491b.zip |
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index d17b65e2d..1260e3ef8 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -2997,27 +2997,22 @@ void cProtocol_1_8_0::SendEntitySpawn(const cEntity & a_Entity, const UInt8 a_Ob { ASSERT(m_State == 3); // In game mode? + cPacketizer Pkt(*this, pktSpawnObject); + Pkt.WriteVarInt32(a_Entity.GetUniqueID()); + Pkt.WriteBEUInt8(a_ObjectType); + Pkt.WriteFPInt(a_Entity.GetPosX()); + Pkt.WriteFPInt(a_Entity.GetPosY()); + Pkt.WriteFPInt(a_Entity.GetPosZ()); + Pkt.WriteByteAngle(a_Entity.GetPitch()); + Pkt.WriteByteAngle(a_Entity.GetYaw()); + Pkt.WriteBEInt32(a_ObjectData); + + if (a_ObjectData != 0) { - cPacketizer Pkt(*this, pktSpawnObject); - Pkt.WriteVarInt32(a_Entity.GetUniqueID()); - Pkt.WriteBEUInt8(a_ObjectType); - Pkt.WriteFPInt(a_Entity.GetPosX()); // Position appears to be ignored... - Pkt.WriteFPInt(a_Entity.GetPosY()); - Pkt.WriteFPInt(a_Entity.GetPosY()); - Pkt.WriteByteAngle(a_Entity.GetPitch()); - Pkt.WriteByteAngle(a_Entity.GetYaw()); - Pkt.WriteBEInt32(a_ObjectData); - - if (a_ObjectData != 0) - { - Pkt.WriteBEInt16(static_cast<Int16>(a_Entity.GetSpeedX() * 400)); - Pkt.WriteBEInt16(static_cast<Int16>(a_Entity.GetSpeedY() * 400)); - Pkt.WriteBEInt16(static_cast<Int16>(a_Entity.GetSpeedZ() * 400)); - } + Pkt.WriteBEInt16(static_cast<Int16>(a_Entity.GetSpeedX() * 400)); + Pkt.WriteBEInt16(static_cast<Int16>(a_Entity.GetSpeedY() * 400)); + Pkt.WriteBEInt16(static_cast<Int16>(a_Entity.GetSpeedZ() * 400)); } - - // Otherwise 1.8 clients don't show the entity - SendEntityTeleport(a_Entity); } |