summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-05 23:02:08 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-05 23:02:08 +0200
commitb818addde4a11196e3070e9a1f03cdd807006ed4 (patch)
tree81502475746e6871e9ed9fb9fc76c43cf52f0db1
parentProtoProxy: Updated to protocol 1.6.1 (#73) (diff)
downloadcuberite-b818addde4a11196e3070e9a1f03cdd807006ed4.tar
cuberite-b818addde4a11196e3070e9a1f03cdd807006ed4.tar.gz
cuberite-b818addde4a11196e3070e9a1f03cdd807006ed4.tar.bz2
cuberite-b818addde4a11196e3070e9a1f03cdd807006ed4.tar.lz
cuberite-b818addde4a11196e3070e9a1f03cdd807006ed4.tar.xz
cuberite-b818addde4a11196e3070e9a1f03cdd807006ed4.tar.zst
cuberite-b818addde4a11196e3070e9a1f03cdd807006ed4.zip
-rw-r--r--source/ClientHandle.cpp3
-rw-r--r--source/Protocol/Protocol16x.cpp28
-rw-r--r--source/Protocol/Protocol16x.h1
3 files changed, 28 insertions, 4 deletions
diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp
index 9a84d23f5..138209a73 100644
--- a/source/ClientHandle.cpp
+++ b/source/ClientHandle.cpp
@@ -254,6 +254,9 @@ void cClientHandle::Authenticate(void)
// Send health
m_Player->SendHealth();
+ // Send gamemode (1.6.1 movementSpeed):
+ SendGameMode(m_Player->GetGameMode());
+
m_Player->Initialize(World);
StreamChunks();
m_State = csDownloadingWorld;
diff --git a/source/Protocol/Protocol16x.cpp b/source/Protocol/Protocol16x.cpp
index d9cec5345..8c93d6052 100644
--- a/source/Protocol/Protocol16x.cpp
+++ b/source/Protocol/Protocol16x.cpp
@@ -35,10 +35,12 @@ Implements the 1.6.x protocol classes:
enum
{
- PACKET_CHAT = 0x03,
- PACKET_UPDATE_HEALTH = 0x08,
- PACKET_ATTACH_ENTITY = 0x27,
- PACKET_WINDOW_OPEN = 0x64,
+ PACKET_CHAT = 0x03,
+ PACKET_UPDATE_HEALTH = 0x08,
+ PACKET_ATTACH_ENTITY = 0x27,
+ PACKET_ENTITY_PROPERTIES = 0x2c,
+ PACKET_WINDOW_OPEN = 0x64,
+ PACKET_PLAYER_ABILITIES = 0xca,
} ;
@@ -77,6 +79,24 @@ void cProtocol161::SendChat(const AString & a_Message)
+void cProtocol161::SendGameMode(eGameMode a_GameMode)
+{
+ super::SendGameMode(a_GameMode);
+
+ // Also send the EntityProperties packet specifying the movementSpeed:
+ cCSLock Lock(m_CSPacket);
+ WriteByte(PACKET_ENTITY_PROPERTIES);
+ WriteInt(m_Client->GetPlayer()->GetUniqueID());
+ WriteInt(1);
+ WriteString("generic.movementSpeed");
+ WriteDouble(0.1);
+ Flush();
+}
+
+
+
+
+
void cProtocol161::SendHealth(void)
{
cCSLock Lock(m_CSPacket);
diff --git a/source/Protocol/Protocol16x.h b/source/Protocol/Protocol16x.h
index 60e3d1360..5bc924c6d 100644
--- a/source/Protocol/Protocol16x.h
+++ b/source/Protocol/Protocol16x.h
@@ -31,6 +31,7 @@ public:
// cProtocol150 overrides:
virtual void SendAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle) override;
virtual void SendChat (const AString & a_Message) override;
+ virtual void SendGameMode (eGameMode a_GameMode) override;
virtual void SendHealth (void) override;
virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;