11-15-2012, 07:21 PM
This diff allows you to compile MCServer from svn to work with MC protocol 49.
Code:
Index: Protocol/ProtocolRecognizer.cpp
===================================================================
--- Protocol/ProtocolRecognizer.cpp (revision 1040)
+++ Protocol/ProtocolRecognizer.cpp (working copy)
@@ -573,6 +573,11 @@
m_Protocol = new cProtocol142(m_Client);
return true;
}
+ if (ch == PROTO_VERSION_1_4_4)
+ {
+ m_Protocol = new cProtocol142(m_Client);
+ return true;
+ }
m_Protocol = new cProtocol125(m_Client);
return true;
}
@@ -599,7 +604,6 @@
);
break;
}
-
case PROTO_VERSION_1_4_2:
{
// The server list ping now has 1 more byte of "magic". Mojang just loves to complicate stuff.
@@ -612,7 +616,7 @@
m_Buffer.ReadByte(val);
ASSERT(val == 0x01);
}
-
+
// http://wiki.vg/wiki/index.php?title=Server_List_Ping&oldid=3100
AString NumPlayers;
Printf(NumPlayers, "%d", cRoot::Get()->GetDefaultWorld()->GetNumPlayers());
@@ -634,6 +638,36 @@
Reply.append(MaxPlayers);
break;
}
+ case PROTO_VERSION_1_4_4:
+ {
+ if (m_Buffer.CanReadBytes(1))
+ {
+ byte val;
+ m_Buffer.ReadByte(val);
+ ASSERT(val == 0x01);
+ }
+
+ // http://wiki.vg/wiki/index.php?title=Server_List_Ping&oldid=3100
+ AString NumPlayers;
+ Printf(NumPlayers, "%d", cRoot::Get()->GetDefaultWorld()->GetNumPlayers());
+ AString MaxPlayers;
+ Printf(MaxPlayers, "%d", cRoot::Get()->GetDefaultWorld()->GetMaxPlayers());
+
+ // Cannot use Printf() because of in-string NUL bytes.
+ Reply = cChatColor::Delimiter;
+ Reply.append("1");
+ Reply.push_back(0);
+ Reply.append("49");
+ Reply.push_back(0);
+ Reply.append("1.4.4");
+ Reply.push_back(0);
+ Reply.append(cRoot::Get()->GetDefaultWorld()->GetDescription());
+ Reply.push_back(0);
+ Reply.append(NumPlayers);
+ Reply.push_back(0);
+ Reply.append(MaxPlayers);
+ break;
+ }
} // switch (m_PrimaryServerVersion)
m_Client->Kick(Reply);
}
Index: Protocol/ProtocolRecognizer.h
===================================================================
--- Protocol/ProtocolRecognizer.h (revision 1040)
+++ Protocol/ProtocolRecognizer.h (working copy)
@@ -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"
-#define MCS_PROTOCOL_VERSIONS "29, 39, 47"
+#define MCS_CLIENT_VERSIONS "1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4"
+#define MCS_PROTOCOL_VERSIONS "29, 39, 47, 49"
@@ -36,8 +36,9 @@
PROTO_VERSION_1_2_5 = 29,
PROTO_VERSION_1_3_2 = 39,
PROTO_VERSION_1_4_2 = 47,
+ PROTO_VERSION_1_4_4 = 49,
- PROTO_VERSION_LATEST = PROTO_VERSION_1_4_2, // Keep this up to date, this serves as the default for PrimaryServerVersion
+ PROTO_VERSION_LATEST = PROTO_VERSION_1_4_4, // Keep this up to date, this serves as the default for PrimaryServerVersion
} ;
cProtocolRecognizer(cClientHandle * a_Client);