summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-31 21:18:01 +0100
committerluksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-31 21:18:01 +0100
commit9012e834d7babadd3f2f2a41cbb8d03b8fb689a1 (patch)
tree492f95cabb6f02fd3933669936a58c3328c013ed
parentAdded the [Server].PrimaryServerVersion setting to settings.ini; 1.4.2 gets the correct version (diff)
downloadcuberite-9012e834d7babadd3f2f2a41cbb8d03b8fb689a1.tar
cuberite-9012e834d7babadd3f2f2a41cbb8d03b8fb689a1.tar.gz
cuberite-9012e834d7babadd3f2f2a41cbb8d03b8fb689a1.tar.bz2
cuberite-9012e834d7babadd3f2f2a41cbb8d03b8fb689a1.tar.lz
cuberite-9012e834d7babadd3f2f2a41cbb8d03b8fb689a1.tar.xz
cuberite-9012e834d7babadd3f2f2a41cbb8d03b8fb689a1.tar.zst
cuberite-9012e834d7babadd3f2f2a41cbb8d03b8fb689a1.zip
Diffstat (limited to '')
-rw-r--r--VC2008/MCServer.vcproj8
-rw-r--r--source/Protocol/Protocol142.cpp112
-rw-r--r--source/Protocol/Protocol142.h39
-rw-r--r--source/Protocol/ProtocolRecognizer.cpp6
-rw-r--r--source/Protocol/ProtocolRecognizer.h4
5 files changed, 167 insertions, 2 deletions
diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj
index f194e4b31..c4a0dbb73 100644
--- a/VC2008/MCServer.vcproj
+++ b/VC2008/MCServer.vcproj
@@ -2067,6 +2067,14 @@
>
</File>
<File
+ RelativePath="..\source\Protocol\Protocol142.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\source\Protocol\Protocol142.h"
+ >
+ </File>
+ <File
RelativePath="..\source\Protocol\ProtocolRecognizer.cpp"
>
</File>
diff --git a/source/Protocol/Protocol142.cpp b/source/Protocol/Protocol142.cpp
new file mode 100644
index 000000000..6784a8ea4
--- /dev/null
+++ b/source/Protocol/Protocol142.cpp
@@ -0,0 +1,112 @@
+
+// Protocol142.cpp
+
+// Implements the cProtocol142 class representing the release 1.4.2 protocol (#47)
+
+#include "Globals.h"
+#include "Protocol142.h"
+#include "../Root.h"
+#include "../Server.h"
+#include "../ClientHandle.h"
+#include "../../CryptoPP/randpool.h"
+#include "../Item.h"
+#include "ChunkDataSerializer.h"
+#include "../Player.h"
+#include "../Mobs/Monster.h"
+#include "../UI/Window.h"
+#include "../Pickup.h"
+
+
+
+
+
+#define HANDLE_PACKET_READ(Proc, Type, Var) \
+ Type Var; \
+ { \
+ if (!m_ReceivedData.Proc(Var)) \
+ { \
+ return PARSE_INCOMPLETE; \
+ } \
+ }
+
+
+
+
+
+typedef unsigned char Byte;
+
+
+
+
+
+enum
+{
+ PACKET_UPDATE_TIME = 0x04,
+ PACKET_SOUND_PARTICLE_EFFECT = 0x3d
+} ;
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cProtocol142:
+
+cProtocol142::cProtocol142(cClientHandle * a_Client) :
+ super(a_Client)
+{
+ LOGD("Created cProtocol142 at %p", this);
+}
+
+
+
+
+
+cProtocol142::~cProtocol142()
+{
+ if (!m_DataToSend.empty())
+ {
+ LOGD("There are %d unsent bytes while deleting cProtocol142", m_DataToSend.size());
+ }
+ LOGD("Deleted cProtocol142 at %p", this);
+}
+
+
+
+
+
+int cProtocol142::ParseLogin(void)
+{
+ // This packet seems to be back in 1.4.2, no documentation yet.
+ return PARSE_OK;
+}
+
+
+
+
+
+void cProtocol142::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data)
+{
+ cCSLock Lock(m_CSPacket);
+ WriteByte(PACKET_SOUND_PARTICLE_EFFECT);
+ WriteInt (a_EffectID);
+ WriteInt (a_SrcX / 8);
+ WriteByte(a_SrcY / 8);
+ WriteInt (a_SrcZ / 8);
+ WriteInt (a_Data);
+ WriteBool(0);
+ Flush();
+}
+
+
+
+
+
+void cProtocol142::SendTimeUpdate(Int64 a_WorldTime)
+{
+ cCSLock Lock(m_CSPacket);
+ WriteByte (PACKET_UPDATE_TIME);
+ WriteInt64(1);
+ WriteInt64(a_WorldTime);
+ Flush();
+} \ No newline at end of file
diff --git a/source/Protocol/Protocol142.h b/source/Protocol/Protocol142.h
new file mode 100644
index 000000000..e84cab72c
--- /dev/null
+++ b/source/Protocol/Protocol142.h
@@ -0,0 +1,39 @@
+
+// Protocol142.h
+
+// Interfaces to the cProtocol142 class representing the release 1.4.2 protocol (#47)
+
+
+
+
+
+#pragma once
+
+#include "Protocol132.h"
+#include "../../CryptoPP/modes.h"
+#include "../../CryptoPP/aes.h"
+
+
+
+
+
+class cProtocol142 :
+ public cProtocol132
+{
+ typedef cProtocol132 super;
+public:
+
+ cProtocol142(cClientHandle * a_Client);
+ virtual ~cProtocol142();
+
+ // Sending commands (alphabetically sorted):
+ virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
+ virtual void SendTimeUpdate (Int64 a_WorldTime) override;
+
+ // Specific packet parsers:
+ virtual int ParseLogin (void) override;
+} ;
+
+
+
+
diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp
index fcd61d269..5b266bd34 100644
--- a/source/Protocol/ProtocolRecognizer.cpp
+++ b/source/Protocol/ProtocolRecognizer.cpp
@@ -9,6 +9,7 @@
#include "ProtocolRecognizer.h"
#include "Protocol125.h"
#include "Protocol132.h"
+#include "Protocol142.h"
#include "../ClientHandle.h"
#include "../Root.h"
#include "../World.h"
@@ -567,6 +568,11 @@ bool cProtocolRecognizer::TryRecognizeProtocol(void)
m_Protocol = new cProtocol132(m_Client);
return true;
}
+ if (ch == PROTO_VERSION_1_4_2)
+ {
+ m_Protocol = new cProtocol142(m_Client);
+ return true;
+ }
m_Protocol = new cProtocol125(m_Client);
return true;
}
diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h
index 451f7fa4d..fb82502f4 100644
--- a/source/Protocol/ProtocolRecognizer.h
+++ b/source/Protocol/ProtocolRecognizer.h
@@ -18,8 +18,8 @@
// Adjust these if a new protocol is added or an old one is removed:
-#define MCS_CLIENT_VERSIONS "1.2.4, 1.2.5, 1.3.1, 1.3.2"
-#define MCS_PROTOCOL_VERSIONS "29, 39"
+#define MCS_CLIENT_VERSIONS "1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2"
+#define MCS_PROTOCOL_VERSIONS "29, 39, 47"