summaryrefslogtreecommitdiffstats
path: root/source/Protocol
diff options
context:
space:
mode:
authorkeyboard.osh@gmail.com <keyboard.osh@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-18 03:51:55 +0100
committerkeyboard.osh@gmail.com <keyboard.osh@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-18 03:51:55 +0100
commit8557ed83593444b3bfbf9dabb1a6ebbaa10299d3 (patch)
treec560c8243d5c93251ac308253e9d5870ee0f70e1 /source/Protocol
parentRewritten generators so that they use the cChunkDesc class (and thus can use cBlockArea merging) (diff)
downloadcuberite-8557ed83593444b3bfbf9dabb1a6ebbaa10299d3.tar
cuberite-8557ed83593444b3bfbf9dabb1a6ebbaa10299d3.tar.gz
cuberite-8557ed83593444b3bfbf9dabb1a6ebbaa10299d3.tar.bz2
cuberite-8557ed83593444b3bfbf9dabb1a6ebbaa10299d3.tar.lz
cuberite-8557ed83593444b3bfbf9dabb1a6ebbaa10299d3.tar.xz
cuberite-8557ed83593444b3bfbf9dabb1a6ebbaa10299d3.tar.zst
cuberite-8557ed83593444b3bfbf9dabb1a6ebbaa10299d3.zip
Diffstat (limited to 'source/Protocol')
-rw-r--r--source/Protocol/Protocol.h1
-rw-r--r--source/Protocol/Protocol125.cpp16
-rw-r--r--source/Protocol/Protocol125.h1
-rw-r--r--source/Protocol/ProtocolRecognizer.cpp8
-rw-r--r--source/Protocol/ProtocolRecognizer.h1
5 files changed, 27 insertions, 0 deletions
diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h
index 7a3270541..97c80ce35 100644
--- a/source/Protocol/Protocol.h
+++ b/source/Protocol/Protocol.h
@@ -62,6 +62,7 @@ public:
virtual void SendDisconnect (const AString & a_Reason) = 0;
virtual void SendEntHeadLook (const cEntity & a_Entity) = 0;
virtual void SendEntLook (const cEntity & a_Entity) = 0;
+ virtual void SendEntVelocity (const cEntity & a_Entity) = 0;
virtual void SendEntRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) = 0;
virtual void SendEntRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) = 0;
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) = 0;
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)
{
diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h
index b3dd79069..8b724e036 100644
--- a/source/Protocol/Protocol125.h
+++ b/source/Protocol/Protocol125.h
@@ -39,6 +39,7 @@ public:
virtual void SendDisconnect (const AString & a_Reason) override;
virtual void SendEntHeadLook (const cEntity & a_Entity) override;
virtual void SendEntLook (const cEntity & a_Entity) override;
+ virtual void SendEntVelocity (const cEntity & a_Entity) override;
virtual void SendEntRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
virtual void SendEntRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp
index 935d89b9e..787672286 100644
--- a/source/Protocol/ProtocolRecognizer.cpp
+++ b/source/Protocol/ProtocolRecognizer.cpp
@@ -197,6 +197,14 @@ void cProtocolRecognizer::SendDisconnect(const AString & a_Reason)
+void cProtocolRecognizer::SendEntVelocity(const cEntity & a_Entity)
+{
+ ASSERT(m_Protocol != NULL);
+ m_Protocol->SendEntVelocity(a_Entity);
+}
+
+
+
void cProtocolRecognizer::SendEntHeadLook(const cEntity & a_Entity)
{
diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h
index 682e6fcf3..866a84eb0 100644
--- a/source/Protocol/ProtocolRecognizer.h
+++ b/source/Protocol/ProtocolRecognizer.h
@@ -66,6 +66,7 @@ public:
virtual void SendDisconnect (const AString & a_Reason) override;
virtual void SendEntHeadLook (const cEntity & a_Entity) override;
virtual void SendEntLook (const cEntity & a_Entity) override;
+ virtual void SendEntVelocity (const cEntity & a_Entity) override;
virtual void SendEntRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
virtual void SendEntRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override;
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;