diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/Blocks/BlockSign.h | 11 | ||||
-rw-r--r-- | source/ClientHandle.cpp | 9 | ||||
-rw-r--r-- | source/ClientHandle.h | 1 | ||||
-rw-r--r-- | source/Protocol/Protocol.h | 1 | ||||
-rw-r--r-- | source/Protocol/Protocol125.cpp | 13 | ||||
-rw-r--r-- | source/Protocol/Protocol125.h | 1 | ||||
-rw-r--r-- | source/Protocol/Protocol16x.cpp | 17 | ||||
-rw-r--r-- | source/Protocol/Protocol16x.h | 1 | ||||
-rw-r--r-- | source/Protocol/ProtocolRecognizer.cpp | 10 | ||||
-rw-r--r-- | source/Protocol/ProtocolRecognizer.h | 1 |
10 files changed, 65 insertions, 0 deletions
diff --git a/source/Blocks/BlockSign.h b/source/Blocks/BlockSign.h index a89ae0c49..09fa721b6 100644 --- a/source/Blocks/BlockSign.h +++ b/source/Blocks/BlockSign.h @@ -66,6 +66,17 @@ public: } return 0x2; } + + + virtual void OnPlacedByPlayer( + cWorld * a_World, cPlayer * a_Player, + int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, + int a_CursorX, int a_CursorY, int a_CursorZ, + BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta + ) override + { + a_Player->GetClientHandle()->SendEditSign(a_BlockX, a_BlockY, a_BlockZ); + } } ; diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp index d66e47d32..526d00b98 100644 --- a/source/ClientHandle.cpp +++ b/source/ClientHandle.cpp @@ -1491,6 +1491,15 @@ void cClientHandle::SendDisconnect(const AString & a_Reason) +void cClientHandle::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + m_Protocol->SendEditSign(a_BlockX, a_BlockY, a_BlockZ); +} + + + + + void cClientHandle::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) { m_Protocol->SendEntityEquipment(a_Entity, a_SlotNum, a_Item); diff --git a/source/ClientHandle.h b/source/ClientHandle.h index 9cf1a3326..0f1daa72c 100644 --- a/source/ClientHandle.h +++ b/source/ClientHandle.h @@ -97,6 +97,7 @@ public: void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player); void SendDestroyEntity (const cEntity & a_Entity); void SendDisconnect (const AString & a_Reason); + void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ); void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item); void SendEntityHeadLook (const cEntity & a_Entity); void SendEntityLook (const cEntity & a_Entity); diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h index ab1b632ff..1a154ea95 100644 --- a/source/Protocol/Protocol.h +++ b/source/Protocol/Protocol.h @@ -60,6 +60,7 @@ public: virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) = 0; virtual void SendDestroyEntity (const cEntity & a_Entity) = 0; virtual void SendDisconnect (const AString & a_Reason) = 0; + virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) = 0; ///< Request the client to open up the sign editor for the sign (1.6+) virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) = 0; virtual void SendEntityHeadLook (const cEntity & a_Entity) = 0; virtual void SendEntityLook (const cEntity & a_Entity) = 0; diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp index 5ecb5b172..1f6dcdec9 100644 --- a/source/Protocol/Protocol125.cpp +++ b/source/Protocol/Protocol125.cpp @@ -278,6 +278,19 @@ void cProtocol125::SendDisconnect(const AString & a_Reason) + +void cProtocol125::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + // This protocol version doesn't support this packet, sign editor is invoked by the client automatically + UNUSED(a_BlockX); + UNUSED(a_BlockY); + UNUSED(a_BlockZ); +} + + + + + void cProtocol125::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) { cCSLock Lock(m_CSPacket); diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h index 2e4f80902..6d0fe2408 100644 --- a/source/Protocol/Protocol125.h +++ b/source/Protocol/Protocol125.h @@ -37,6 +37,7 @@ public: virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override; virtual void SendDestroyEntity (const cEntity & a_Entity) override; virtual void SendDisconnect (const AString & a_Reason) override; + virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+) virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; virtual void SendEntityHeadLook (const cEntity & a_Entity) override; virtual void SendEntityLook (const cEntity & a_Entity) override; diff --git a/source/Protocol/Protocol16x.cpp b/source/Protocol/Protocol16x.cpp index 820e71cd9..4e8fd1887 100644 --- a/source/Protocol/Protocol16x.cpp +++ b/source/Protocol/Protocol16x.cpp @@ -43,6 +43,7 @@ enum PACKET_ATTACH_ENTITY = 0x27, PACKET_ENTITY_PROPERTIES = 0x2c, PACKET_WINDOW_OPEN = 0x64, + PACKET_TILE_EDITOR_OPEN = 0x85, PACKET_PLAYER_ABILITIES = 0xca, } ; @@ -84,6 +85,22 @@ void cProtocol161::SendChat(const AString & a_Message) + +void cProtocol161::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_TILE_EDITOR_OPEN); + WriteByte(0); + WriteInt(a_BlockX); + WriteInt(a_BlockY); + WriteInt(a_BlockZ); + Flush(); +} + + + + + void cProtocol161::SendGameMode(eGameMode a_GameMode) { super::SendGameMode(a_GameMode); diff --git a/source/Protocol/Protocol16x.h b/source/Protocol/Protocol16x.h index 4dba5eab6..077c7958b 100644 --- a/source/Protocol/Protocol16x.h +++ b/source/Protocol/Protocol16x.h @@ -35,6 +35,7 @@ protected: // cProtocol150 overrides: virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override; virtual void SendChat (const AString & a_Message) override; + virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+) virtual void SendGameMode (eGameMode a_GameMode) override; virtual void SendHealth (void) override; virtual void SendPlayerMaxSpeed(void) override; diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp index de4ccc03e..3cff9789e 100644 --- a/source/Protocol/ProtocolRecognizer.cpp +++ b/source/Protocol/ProtocolRecognizer.cpp @@ -201,6 +201,16 @@ void cProtocolRecognizer::SendDisconnect(const AString & a_Reason) +void cProtocolRecognizer::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + ASSERT(m_Protocol != NULL); + m_Protocol->SendEditSign(a_BlockX, a_BlockY, a_BlockZ); +} + + + + + void cProtocolRecognizer::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) { ASSERT(m_Protocol != NULL); diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h index 2179f3b05..1256f38e0 100644 --- a/source/Protocol/ProtocolRecognizer.h +++ b/source/Protocol/ProtocolRecognizer.h @@ -67,6 +67,7 @@ public: virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override; virtual void SendDestroyEntity (const cEntity & a_Entity) override; virtual void SendDisconnect (const AString & a_Reason) override; + virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+) virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; virtual void SendEntityHeadLook (const cEntity & a_Entity) override; virtual void SendEntityLook (const cEntity & a_Entity) override; |