summaryrefslogtreecommitdiffstats
path: root/source/Protocol
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-30 18:37:44 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-30 18:37:44 +0200
commitba2a9b6b2c1519563662a6a1147a82f96afb36dc (patch)
treef176e14fa7afa14a3e598350779bcb755b9d0339 /source/Protocol
parentFixed initial player head rotation when a player is being spawned on another client (diff)
downloadcuberite-ba2a9b6b2c1519563662a6a1147a82f96afb36dc.tar
cuberite-ba2a9b6b2c1519563662a6a1147a82f96afb36dc.tar.gz
cuberite-ba2a9b6b2c1519563662a6a1147a82f96afb36dc.tar.bz2
cuberite-ba2a9b6b2c1519563662a6a1147a82f96afb36dc.tar.lz
cuberite-ba2a9b6b2c1519563662a6a1147a82f96afb36dc.tar.xz
cuberite-ba2a9b6b2c1519563662a6a1147a82f96afb36dc.tar.zst
cuberite-ba2a9b6b2c1519563662a6a1147a82f96afb36dc.zip
Diffstat (limited to 'source/Protocol')
-rw-r--r--source/Protocol/Protocol.h1
-rw-r--r--source/Protocol/Protocol125.cpp25
-rw-r--r--source/Protocol/Protocol125.h1
-rw-r--r--source/Protocol/ProtocolRecognizer.cpp10
-rw-r--r--source/Protocol/ProtocolRecognizer.h1
5 files changed, 37 insertions, 1 deletions
diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h
index c187387c1..c98f2729b 100644
--- a/source/Protocol/Protocol.h
+++ b/source/Protocol/Protocol.h
@@ -85,6 +85,7 @@ public:
virtual void SendWindowClose (char a_WindowID) = 0;
virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) = 0;
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) = 0;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ) = 0;
/// Returns the ServerID used for authentication through session.minecraft.net
virtual AString GetAuthServerID(void) = 0;
diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp
index bec6a19b6..53b9b55db 100644
--- a/source/Protocol/Protocol125.cpp
+++ b/source/Protocol/Protocol125.cpp
@@ -52,7 +52,7 @@ enum
PACKET_PLAYER_SPAWN = 0x14,
PACKET_PICKUP_SPAWN = 0x15,
PACKET_COLLECT_PICKUP = 0x16,
- PACKET_ADD_VEHICLE = 0x17,
+ PACKET_SPAWN_OBJECT = 0x17,
PACKET_SPAWN_MOB = 0x18,
PACKET_DESTROY_ENTITY = 0x1d,
PACKET_ENTITY = 0x1e,
@@ -794,6 +794,29 @@ void cProtocol125::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_Bloc
+void cProtocol125::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ)
+{
+ cCSLock Lock(m_CSPacket);
+ WriteByte(PACKET_SPAWN_OBJECT);
+ WriteInt (a_Entity.GetUniqueID());
+ WriteByte(a_ObjectType);
+ WriteInt ((int)(a_Entity.GetPosX() * 32));
+ WriteInt ((int)(a_Entity.GetPosY() * 32));
+ WriteInt ((int)(a_Entity.GetPosZ() * 32));
+ WriteInt (a_ObjectData);
+ if( a_ObjectData != 0 )
+ {
+ WriteShort( a_SpeedX );
+ WriteShort( a_SpeedY );
+ WriteShort( a_SpeedZ );
+ }
+ Flush();
+}
+
+
+
+
+
AString cProtocol125::GetAuthServerID(void)
{
// http://wiki.vg/wiki/index.php?title=Session&oldid=2262
diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h
index 84dfa7a72..898a53008 100644
--- a/source/Protocol/Protocol125.h
+++ b/source/Protocol/Protocol125.h
@@ -69,6 +69,7 @@ public:
virtual void SendWindowClose (char a_WindowID) override;
virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ) override;
virtual AString GetAuthServerID(void) override;
diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp
index edd34b7dc..3d71c95ee 100644
--- a/source/Protocol/ProtocolRecognizer.cpp
+++ b/source/Protocol/ProtocolRecognizer.cpp
@@ -495,6 +495,16 @@ void cProtocolRecognizer::SendUseBed(const cEntity & a_Entity, int a_BlockX, int
+void cProtocolRecognizer::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ)
+{
+ ASSERT(m_Protocol != NULL);
+ m_Protocol->SendSpawnObject(a_Entity, a_ObjectType, a_ObjectData, a_SpeedX, a_SpeedY, a_SpeedZ);
+}
+
+
+
+
+
AString cProtocolRecognizer::GetAuthServerID(void)
{
ASSERT(m_Protocol != NULL);
diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h
index 2e2f5a9e9..a5099367a 100644
--- a/source/Protocol/ProtocolRecognizer.h
+++ b/source/Protocol/ProtocolRecognizer.h
@@ -80,6 +80,7 @@ public:
virtual void SendWindowClose (char a_WindowID) override;
virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ) override;
virtual AString GetAuthServerID(void) override;