From 8557ed83593444b3bfbf9dabb1a6ebbaa10299d3 Mon Sep 17 00:00:00 2001 From: "keyboard.osh@gmail.com" Date: Mon, 18 Mar 2013 02:51:55 +0000 Subject: Added support for the packet #28 (0x1C): ENTITY_VELOCITY git-svn-id: http://mc-server.googlecode.com/svn/trunk@1283 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Protocol/Protocol125.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source/Protocol/Protocol125.cpp') diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp index 9514fb278..d2f3add7f 100644 --- a/source/Protocol/Protocol125.cpp +++ b/source/Protocol/Protocol125.cpp @@ -55,6 +55,7 @@ enum PACKET_COLLECT_PICKUP = 0x16, PACKET_SPAWN_OBJECT = 0x17, PACKET_SPAWN_MOB = 0x18, + PACKET_ENTITY_VELOCITY = 0x1c, PACKET_DESTROY_ENTITY = 0x1d, PACKET_ENTITY = 0x1e, PACKET_ENT_REL_MOVE = 0x1f, @@ -276,6 +277,21 @@ void cProtocol125::SendDisconnect(const AString & a_Reason) +void cProtocol125::SendEntVelocity(const cEntity & a_Entity) +{ + ASSERT(a_Entity.GetUniqueID() != m_Client->GetPlayer()->GetUniqueID()); // Must not send for self + + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_ENTITY_VELOCITY); + WriteInt (a_Entity.GetUniqueID()); + WriteShort((short) (a_Entity.GetSpeedX() * 400)); //400 = 8000 / 20 + WriteShort((short) (a_Entity.GetSpeedY() * 400)); + WriteShort((short) (a_Entity.GetSpeedZ() * 400)); + Flush(); +} + + + void cProtocol125::SendEntHeadLook(const cEntity & a_Entity) { -- cgit v1.2.3