summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
authorPablo Beltrán <spekdrum@gmail.com>2017-08-21 10:46:41 +0200
committerMattes D <github@xoft.cz>2017-08-21 10:46:41 +0200
commitb18f6637b6c58db20353cd3e77584b646ab36b5c (patch)
tree77b1dcf42aec23ef4aa64a04c906282c5f61ba19 /src/Protocol
parentChanged MoveToWorld to ScheduleMoveToWorld in cPlayer::Respawn (#3922) (diff)
downloadcuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.gz
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.bz2
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.lz
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.xz
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.zst
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.zip
Diffstat (limited to 'src/Protocol')
-rw-r--r--src/Protocol/Protocol.h2
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp20
-rw-r--r--src/Protocol/ProtocolRecognizer.h2
-rw-r--r--src/Protocol/Protocol_1_12.cpp24
-rw-r--r--src/Protocol/Protocol_1_12.h2
-rw-r--r--src/Protocol/Protocol_1_8.cpp28
-rw-r--r--src/Protocol/Protocol_1_8.h2
-rw-r--r--src/Protocol/Protocol_1_9.cpp24
-rw-r--r--src/Protocol/Protocol_1_9.h2
9 files changed, 106 insertions, 0 deletions
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h
index 18ede0640..54c5b7223 100644
--- a/src/Protocol/Protocol.h
+++ b/src/Protocol/Protocol.h
@@ -91,6 +91,7 @@ public:
virtual void SendHideTitle (void) = 0;
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) = 0;
virtual void SendKeepAlive (UInt32 a_PingID) = 0;
+ virtual void SendLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) = 0;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0;
virtual void SendLoginSuccess (void) = 0;
virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) = 0;
@@ -134,6 +135,7 @@ public:
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) = 0;
virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) = 0;
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) = 0;
+ virtual void SendUnleashEntity (const cEntity & a_Entity) = 0;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) = 0;
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) = 0;
virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) = 0;
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index a65fb931e..cb2a4fc9d 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -468,6 +468,26 @@ void cProtocolRecognizer::SendKeepAlive(UInt32 a_PingID)
+void cProtocolRecognizer::SendLeashEntity(const cEntity & a_Entity, const cEntity & a_EntityLeashedTo)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendLeashEntity(a_Entity, a_EntityLeashedTo);
+}
+
+
+
+
+
+void cProtocolRecognizer::SendUnleashEntity(const cEntity & a_Entity)
+{
+ ASSERT(m_Protocol != nullptr);
+ m_Protocol->SendUnleashEntity(a_Entity);
+}
+
+
+
+
+
void cProtocolRecognizer::SendLogin(const cPlayer & a_Player, const cWorld & a_World)
{
ASSERT(m_Protocol != nullptr);
diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h
index 4c338a5b8..295c6db16 100644
--- a/src/Protocol/ProtocolRecognizer.h
+++ b/src/Protocol/ProtocolRecognizer.h
@@ -87,6 +87,7 @@ public:
virtual void SendHideTitle (void) override;
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
virtual void SendKeepAlive (UInt32 a_PingID) override;
+ virtual void SendLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendLoginSuccess (void) override;
virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) override;
@@ -130,6 +131,7 @@ public:
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override;
+ virtual void SendUnleashEntity (const cEntity & a_Entity) override;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
diff --git a/src/Protocol/Protocol_1_12.cpp b/src/Protocol/Protocol_1_12.cpp
index b9eb1801d..0dba45e15 100644
--- a/src/Protocol/Protocol_1_12.cpp
+++ b/src/Protocol/Protocol_1_12.cpp
@@ -1252,6 +1252,30 @@ void cProtocol_1_12::SendScoreUpdate(const AString & a_Objective, const AString
+void cProtocol_1_12::SendLeashEntity(const cEntity & a_Entity, const cEntity & a_EntityLeashedTo)
+{
+ ASSERT(m_State == 3); // In game mode?
+ cPacketizer Pkt(*this, 0x3c); // Set Attach Entity packet
+ Pkt.WriteBEUInt32(a_Entity.GetUniqueID());
+ Pkt.WriteBEUInt32(a_EntityLeashedTo.GetUniqueID());
+}
+
+
+
+
+
+void cProtocol_1_12::SendUnleashEntity(const cEntity & a_Entity)
+{
+ ASSERT(m_State == 3); // In game mode?
+ cPacketizer Pkt(*this, 0x3c); // Set Attach Entity packet
+ Pkt.WriteBEUInt32(a_Entity.GetUniqueID());
+ Pkt.WriteBEInt32(-1); // Unleash a_Entity
+}
+
+
+
+
+
void cProtocol_1_12::SendLogin(const cPlayer & a_Player, const cWorld & a_World)
{
// Send the Join Game packet:
diff --git a/src/Protocol/Protocol_1_12.h b/src/Protocol/Protocol_1_12.h
index 53ff05aa6..e1fc12149 100644
--- a/src/Protocol/Protocol_1_12.h
+++ b/src/Protocol/Protocol_1_12.h
@@ -48,6 +48,7 @@ public:
virtual void SendExperience(void) override;
virtual void SendHealth(void) override;
virtual void SendHideTitle(void) override;
+ virtual void SendLeashEntity(const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) override;
virtual void SendLogin(const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendPlayerMaxSpeed(void) override;
virtual void SendRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID) override;
@@ -62,6 +63,7 @@ public:
virtual void SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override;
virtual void SendTitleTimes(int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
virtual void SendUpdateBlockEntity(cBlockEntity & a_BlockEntity) override;
+ virtual void SendUnleashEntity(const cEntity & a_Entity) override;
protected:
virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override;
virtual void HandlePacketAdvancementTab(cByteBuffer & a_ByteBuffer);
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp
index 873ed2902..f278437ff 100644
--- a/src/Protocol/Protocol_1_8.cpp
+++ b/src/Protocol/Protocol_1_8.cpp
@@ -629,6 +629,34 @@ void cProtocol_1_8_0::SendKeepAlive(UInt32 a_PingID)
+void cProtocol_1_8_0::SendLeashEntity(const cEntity & a_Entity, const cEntity & a_EntityLeashedTo)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, 0x1b); // Attach Entity packet
+ Pkt.WriteBEUInt32(a_Entity.GetUniqueID());
+ Pkt.WriteBEUInt32(a_EntityLeashedTo.GetUniqueID());
+ Pkt.WriteBool(true);
+}
+
+
+
+
+
+void cProtocol_1_8_0::SendUnleashEntity(const cEntity & a_Entity)
+{
+ ASSERT(m_State == 3); // In game mode?
+
+ cPacketizer Pkt(*this, 0x1b); // Attach Entity packet
+ Pkt.WriteBEUInt32(a_Entity.GetUniqueID());
+ Pkt.WriteBEInt32(-1);
+ Pkt.WriteBool(true);
+}
+
+
+
+
+
void cProtocol_1_8_0::SendLogin(const cPlayer & a_Player, const cWorld & a_World)
{
// Send the Join Game packet:
diff --git a/src/Protocol/Protocol_1_8.h b/src/Protocol/Protocol_1_8.h
index 0adf7a93c..b04e5c5f0 100644
--- a/src/Protocol/Protocol_1_8.h
+++ b/src/Protocol/Protocol_1_8.h
@@ -80,6 +80,7 @@ public:
virtual void SendHideTitle (void) override;
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
virtual void SendKeepAlive (UInt32 a_PingID) override;
+ virtual void SendLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendLoginSuccess (void) override;
virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) override;
@@ -123,6 +124,7 @@ public:
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override;
+ virtual void SendUnleashEntity (const cEntity & a_Entity) override;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp
index 56f41ec51..167bc4ddf 100644
--- a/src/Protocol/Protocol_1_9.cpp
+++ b/src/Protocol/Protocol_1_9.cpp
@@ -648,6 +648,30 @@ void cProtocol_1_9_0::SendKeepAlive(UInt32 a_PingID)
+void cProtocol_1_9_0::SendLeashEntity(const cEntity & a_Entity, const cEntity & a_EntityLeashedTo)
+{
+ ASSERT(m_State == 3); // In game mode?
+ cPacketizer Pkt(*this, 0x3a); // Set Attach Entity packet
+ Pkt.WriteBEUInt32(a_Entity.GetUniqueID());
+ Pkt.WriteBEUInt32(a_EntityLeashedTo.GetUniqueID());
+}
+
+
+
+
+
+void cProtocol_1_9_0::SendUnleashEntity(const cEntity & a_Entity)
+{
+ ASSERT(m_State == 3); // In game mode?
+ cPacketizer Pkt(*this, 0x3a); // Set Attach Entity packet
+ Pkt.WriteBEUInt32(a_Entity.GetUniqueID());
+ Pkt.WriteBEInt32(-1); // Unleash a_Entity
+}
+
+
+
+
+
void cProtocol_1_9_0::SendLogin(const cPlayer & a_Player, const cWorld & a_World)
{
// Send the Join Game packet:
diff --git a/src/Protocol/Protocol_1_9.h b/src/Protocol/Protocol_1_9.h
index fcb261575..b4fdc7f67 100644
--- a/src/Protocol/Protocol_1_9.h
+++ b/src/Protocol/Protocol_1_9.h
@@ -86,6 +86,7 @@ public:
virtual void SendHideTitle (void) override;
virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override;
virtual void SendKeepAlive (UInt32 a_PingID) override;
+ virtual void SendLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendLoginSuccess (void) override;
virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) override;
@@ -129,6 +130,7 @@ public:
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle) override;
+ virtual void SendUnleashEntity (const cEntity & a_Entity) override;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;