From 01b24d73eab6b0e708063d82f01ea9bb9296550c Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 3 Mar 2013 19:05:11 +0000 Subject: Player can sit in minecarts (but not move them yet) git-svn-id: http://mc-server.googlecode.com/svn/trunk@1249 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Protocol/Protocol.h | 1 + source/Protocol/Protocol125.cpp | 14 ++++++++++++++ source/Protocol/Protocol125.h | 1 + source/Protocol/ProtocolRecognizer.cpp | 10 ++++++++++ source/Protocol/ProtocolRecognizer.h | 1 + 5 files changed, 27 insertions(+) (limited to 'source/Protocol') diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h index 876ab51f5..7a3270541 100644 --- a/source/Protocol/Protocol.h +++ b/source/Protocol/Protocol.h @@ -50,6 +50,7 @@ public: virtual void DataReceived(const char * a_Data, int a_Size) = 0; // Sending stuff to clients (alphabetically sorted): + virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) = 0; virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) = 0; virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) = 0; virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp index 4fef5623e..72a1d3b0c 100644 --- a/source/Protocol/Protocol125.cpp +++ b/source/Protocol/Protocol125.cpp @@ -63,6 +63,7 @@ enum PACKET_ENT_TELEPORT = 0x22, PACKET_ENT_HEAD_LOOK = 0x23, PACKET_ENT_STATUS = 0x26, + PACKET_ATTACH_ENTITY = 0x27, PACKET_METADATA = 0x28, PACKET_PRE_CHUNK = 0x32, PACKET_MAP_CHUNK = 0x33, @@ -122,6 +123,19 @@ cProtocol125::cProtocol125(cClientHandle * a_Client) : +void cProtocol125::SendAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle) +{ + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_ATTACH_ENTITY); + WriteInt(a_Entity.GetUniqueID()); + WriteInt((a_Vehicle == NULL) ? -1 : a_Vehicle->GetUniqueID()); + Flush(); +} + + + + + void cProtocol125::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) { UNUSED(a_BlockType); diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h index ad50c5796..b3dd79069 100644 --- a/source/Protocol/Protocol125.h +++ b/source/Protocol/Protocol125.h @@ -27,6 +27,7 @@ public: virtual void DataReceived(const char * a_Data, int a_Size) override; /// Sending stuff to clients (alphabetically sorted): + virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override; virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override; virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override; virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp index ccce8890d..8a40376a3 100644 --- a/source/Protocol/ProtocolRecognizer.cpp +++ b/source/Protocol/ProtocolRecognizer.cpp @@ -88,6 +88,16 @@ void cProtocolRecognizer::DataReceived(const char * a_Data, int a_Size) +void cProtocolRecognizer::SendAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle) +{ + ASSERT(m_Protocol != NULL); + m_Protocol->SendAttachEntity(a_Entity, a_Vehicle); +} + + + + + void cProtocolRecognizer::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) { ASSERT(m_Protocol != NULL); diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h index fdced8bbe..a4cec69f8 100644 --- a/source/Protocol/ProtocolRecognizer.h +++ b/source/Protocol/ProtocolRecognizer.h @@ -52,6 +52,7 @@ public: virtual void DataReceived(const char * a_Data, int a_Size) override; /// Sending stuff to clients (alphabetically sorted): + virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override; virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override; virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override; virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; -- cgit v1.2.3