diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-02-18 23:13:44 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-02-18 23:13:44 +0100 |
commit | a686656253b9bd11238b2ae2210f809b49c355b9 (patch) | |
tree | 112663e0d7be31401232bd6e3f4f10852776639e /src/Protocol | |
parent | Merge branch 'itemframes' of https://github.com/mc-server/MCServer into itemframes (diff) | |
parent | Merge pull request #696 from mc-server/paintings (diff) | |
download | cuberite-a686656253b9bd11238b2ae2210f809b49c355b9.tar cuberite-a686656253b9bd11238b2ae2210f809b49c355b9.tar.gz cuberite-a686656253b9bd11238b2ae2210f809b49c355b9.tar.bz2 cuberite-a686656253b9bd11238b2ae2210f809b49c355b9.tar.lz cuberite-a686656253b9bd11238b2ae2210f809b49c355b9.tar.xz cuberite-a686656253b9bd11238b2ae2210f809b49c355b9.tar.zst cuberite-a686656253b9bd11238b2ae2210f809b49c355b9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol.h | 2 | ||||
-rw-r--r-- | src/Protocol/Protocol125.h | 1 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 15 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.h | 1 | ||||
-rw-r--r-- | src/Protocol/ProtocolRecognizer.cpp | 8 | ||||
-rw-r--r-- | src/Protocol/ProtocolRecognizer.h | 1 |
6 files changed, 28 insertions, 0 deletions
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h index f5b9fd403..46b627254 100644 --- a/src/Protocol/Protocol.h +++ b/src/Protocol/Protocol.h @@ -24,6 +24,7 @@ class cWindow; class cInventory; class cPawn; class cPickup; +class cPainting; class cWorld; class cMonster; class cChunkDataSerializer; @@ -81,6 +82,7 @@ public: virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) = 0; virtual void SendKeepAlive (int a_PingID) = 0; virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0; + virtual void SendPaintingSpawn (const cPainting & a_Painting) = 0; virtual void SendPickupSpawn (const cPickup & a_Pickup) = 0; virtual void SendPlayerAbilities (void) = 0; virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) = 0; diff --git a/src/Protocol/Protocol125.h b/src/Protocol/Protocol125.h index 1a3209333..54551ea5f 100644 --- a/src/Protocol/Protocol125.h +++ b/src/Protocol/Protocol125.h @@ -56,6 +56,7 @@ public: virtual void SendKeepAlive (int a_PingID) override; virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override; + virtual void SendPaintingSpawn (const cPainting & a_Painting) override {}; virtual void SendPickupSpawn (const cPickup & a_Pickup) override; virtual void SendPlayerAbilities (void) override {} // This protocol doesn't support such message virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override; diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 3d6a8f807..0c569c07c 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -21,6 +21,7 @@ Implements the 1.7.x protocol classes: #include "../Entities/ExpOrb.h" #include "../Entities/Minecart.h" #include "../Entities/FallingBlock.h" +#include "../Entities/Painting.h" #include "../Entities/Pickup.h" #include "../Entities/Player.h" #include "../Entities/ItemFrame.h" @@ -570,6 +571,20 @@ void cProtocol172::SendLogin(const cPlayer & a_Player, const cWorld & a_World) +void cProtocol172::SendPaintingSpawn(const cPainting & a_Painting) +{ + cPacketizer Pkt(*this, 0x10); // Spawn Painting packet + Pkt.WriteVarInt(a_Painting.GetUniqueID()); + Pkt.WriteString(a_Painting.GetName().c_str()); + Pkt.WriteInt((int)a_Painting.GetPosX()); + Pkt.WriteInt((int)a_Painting.GetPosY()); + Pkt.WriteInt((int)a_Painting.GetPosZ()); + Pkt.WriteInt(a_Painting.GetDirection()); +} + + + + void cProtocol172::SendPickupSpawn(const cPickup & a_Pickup) { diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h index d19be0f05..ae3577867 100644 --- a/src/Protocol/Protocol17x.h +++ b/src/Protocol/Protocol17x.h @@ -87,6 +87,7 @@ public: virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override; virtual void SendKeepAlive (int a_PingID) override; virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; + virtual void SendPaintingSpawn (const cPainting & a_Painting) override; virtual void SendPickupSpawn (const cPickup & a_Pickup) override; virtual void SendPlayerAbilities (void) override; virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override; diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index 6e51ee9cd..b658dc9db 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -405,6 +405,14 @@ void cProtocolRecognizer::SendParticleEffect(const AString & a_ParticleName, flo +void cProtocolRecognizer::SendPaintingSpawn(const cPainting & a_Painting) +{ + m_Protocol->SendPaintingSpawn(a_Painting); +} + + + + void cProtocolRecognizer::SendPickupSpawn(const cPickup & a_Pickup) { diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h index 800163be6..abbb22827 100644 --- a/src/Protocol/ProtocolRecognizer.h +++ b/src/Protocol/ProtocolRecognizer.h @@ -91,6 +91,7 @@ public: virtual void SendKeepAlive (int a_PingID) override; virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; virtual void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount) override; + virtual void SendPaintingSpawn (const cPainting & a_Painting) override; virtual void SendPickupSpawn (const cPickup & a_Pickup) override; virtual void SendPlayerAbilities (void) override; virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override; |