1
0

Release 1.5 supported, yay :)

Although some new blocks are still not recognized and behave badly, the protocol itself is working.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1273 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-03-14 20:34:37 +00:00
parent 68b1aa23b0
commit 75cc675bf2
6 changed files with 116 additions and 9 deletions

View File

@ -2174,6 +2174,14 @@
RelativePath="..\source\Protocol\Protocol14x.h"
>
</File>
<File
RelativePath="..\source\Protocol\Protocol15x.cpp"
>
</File>
<File
RelativePath="..\source\Protocol\Protocol15x.h"
>
</File>
<File
RelativePath="..\source\Protocol\ProtocolRecognizer.cpp"
>

View File

@ -44,12 +44,6 @@ Implements the 1.4.x protocol classes representing these protocols:
typedef unsigned char Byte;
enum
{
PACKET_UPDATE_TIME = 0x04,

View File

@ -0,0 +1,59 @@
// Protocol15x.cpp
/*
Implements the 1.5.x protocol classes:
- cProtocol150
- release 1.5 protocol (#60)
(others may be added later in the future for the 1.5 release series)
*/
#include "Globals.h"
#include "Protocol15x.h"
enum
{
PACKET_WINDOW_OPEN = 0x64,
} ;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cProtocol150:
cProtocol150::cProtocol150(cClientHandle * a_Client) :
super(a_Client)
{
}
void cProtocol150::SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots)
{
if (a_WindowType < 0)
{
// Do not send for inventory windows
return;
}
cCSLock Lock(m_CSPacket);
WriteByte (PACKET_WINDOW_OPEN);
WriteByte (a_WindowID);
WriteByte (a_WindowType);
WriteString(a_WindowTitle);
WriteByte (a_NumSlots);
WriteByte (1); // Use title
Flush();
}

View File

@ -0,0 +1,36 @@
// Protocol15x.h
/*
Declares the 1.5.x protocol classes:
- cProtocol150
- release 1.5 protocol (#60)
(others may be added later in the future for the 1.5 release series)
*/
#pragma once
#include "Protocol14x.h"
class cProtocol150 :
public cProtocol146
{
typedef cProtocol146 super;
public:
cProtocol150(cClientHandle * a_Client);
virtual void SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
} ;

View File

@ -10,6 +10,7 @@
#include "Protocol125.h"
#include "Protocol132.h"
#include "Protocol14x.h"
#include "Protocol15x.h"
#include "../ClientHandle.h"
#include "../Root.h"
#include "../World.h"
@ -48,6 +49,7 @@ AString cProtocolRecognizer::GetVersionTextFromInt(int a_ProtocolVersion)
case PROTO_VERSION_1_4_2: return "1.4.2";
case PROTO_VERSION_1_4_4: return "1.4.4";
case PROTO_VERSION_1_4_6: return "1.4.6";
case PROTO_VERSION_1_5_0: return "1.5";
}
ASSERT(!"Unknown protocol version");
return Printf("Unknown protocol (%d)", a_ProtocolVersion);
@ -629,6 +631,11 @@ bool cProtocolRecognizer::TryRecognizeProtocol(void)
m_Protocol = new cProtocol146(m_Client);
return true;
}
case PROTO_VERSION_1_5_0:
{
m_Protocol = new cProtocol150(m_Client);
return true;
}
}
m_Protocol = new cProtocol125(m_Client);
return true;
@ -660,6 +667,7 @@ void cProtocolRecognizer::HandleServerPing(void)
case PROTO_VERSION_1_4_2:
case PROTO_VERSION_1_4_4:
case PROTO_VERSION_1_4_6:
case PROTO_VERSION_1_5_0:
{
// The server list ping now has 1 more byte of "magic". Mojang just loves to complicate stuff.
// http://wiki.vg/wiki/index.php?title=Protocol&oldid=3101#Server_List_Ping_.280xFE.29

View File

@ -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, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7"
#define MCS_PROTOCOL_VERSIONS "29, 39, 47, 49, 51"
#define MCS_CLIENT_VERSIONS "1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5"
#define MCS_PROTOCOL_VERSIONS "29, 39, 47, 49, 51, 60"
@ -38,8 +38,10 @@ public:
PROTO_VERSION_1_4_2 = 47,
PROTO_VERSION_1_4_4 = 49,
PROTO_VERSION_1_4_6 = 51,
PROTO_VERSION_1_5_0 = 60,
PROTO_VERSION_LATEST = PROTO_VERSION_1_4_6, // Keep this up to date, this serves as the default for PrimaryServerVersion
PROTO_VERSION_NEXT,
PROTO_VERSION_LATEST = PROTO_VERSION_NEXT - 1, ///< Automatically assigned to the last protocol version, this serves as the default for PrimaryServerVersion
} ;
cProtocolRecognizer(cClientHandle * a_Client);