Add 1.11.1/1.11.2 protocol (#3575)
This commit is contained in:
parent
9cb1ad546f
commit
c89b20695d
@ -24,7 +24,7 @@ Luksor
|
||||
M10360
|
||||
marmot21
|
||||
Masy98
|
||||
mathias-github
|
||||
mathiascode
|
||||
mborland
|
||||
mgueydan
|
||||
MikeHunsinger
|
||||
|
@ -5,7 +5,7 @@ Cuberite is a Minecraft-compatible multiplayer game server that is written in C+
|
||||
|
||||
Cuberite can run on Windows, *nix and Android operating systems. This includes Android phones and tablets as well as Raspberry Pis.
|
||||
|
||||
We currently support Release 1.8 - 1.10 Minecraft protocol versions.
|
||||
We currently support Release 1.8 - 1.11 Minecraft protocol versions.
|
||||
|
||||
Subscribe to [the newsletter](https://cuberite.org/news/#subscribe) for important updates and project news.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--------------------------------------------------------------------------------
|
||||
Welcome to your new Cuberite server, compatible with Minecraft 1.8 - 1.10!
|
||||
Welcome to your new Cuberite server, compatible with Minecraft 1.8 - 1.11!
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
- To get started with your server, read the user's manual at
|
||||
|
@ -56,6 +56,7 @@ AString cProtocolRecognizer::GetVersionTextFromInt(int a_ProtocolVersion)
|
||||
case PROTO_VERSION_1_9_4: return "1.9.4";
|
||||
case PROTO_VERSION_1_10_0: return "1.10";
|
||||
case PROTO_VERSION_1_11_0: return "1.11";
|
||||
case PROTO_VERSION_1_11_1: return "1.11.1";
|
||||
}
|
||||
ASSERT(!"Unknown protocol version");
|
||||
return Printf("Unknown protocol (%d)", a_ProtocolVersion);
|
||||
@ -1079,6 +1080,11 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema
|
||||
m_Protocol = new cProtocol_1_11_0(m_Client, ServerAddress, ServerPort, NextState);
|
||||
return true;
|
||||
}
|
||||
case PROTO_VERSION_1_11_1:
|
||||
{
|
||||
m_Protocol = new cProtocol_1_11_1(m_Client, ServerAddress, ServerPort, NextState);
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
LOGD("Client \"%s\" uses an unsupported protocol (lengthed, version %u (0x%x))",
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
|
||||
// Adjust these if a new protocol is added or an old one is removed:
|
||||
#define MCS_CLIENT_VERSIONS "1.8.x, 1.9.x, 1.10.x, 1.11"
|
||||
#define MCS_PROTOCOL_VERSIONS "47, 107, 108, 109, 110, 210, 315"
|
||||
#define MCS_CLIENT_VERSIONS "1.8.x, 1.9.x, 1.10.x, 1.11.x"
|
||||
#define MCS_PROTOCOL_VERSIONS "47, 107, 108, 109, 110, 210, 315, 316"
|
||||
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ public:
|
||||
PROTO_VERSION_1_9_4 = 110,
|
||||
PROTO_VERSION_1_10_0 = 210,
|
||||
PROTO_VERSION_1_11_0 = 315,
|
||||
PROTO_VERSION_1_11_1 = 316,
|
||||
} ;
|
||||
|
||||
cProtocolRecognizer(cClientHandle * a_Client);
|
||||
|
@ -282,7 +282,7 @@ namespace Metadata
|
||||
|
||||
|
||||
|
||||
cProtocol_1_10_0::cProtocol_1_10_0(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
|
||||
cProtocol_1_10_0::cProtocol_1_10_0(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
|
||||
super(a_Client, a_ServerAddress, a_ServerPort, a_State)
|
||||
{
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ Implements the 1.11 protocol classes:
|
||||
|
||||
|
||||
|
||||
cProtocol_1_11_0::cProtocol_1_11_0(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
|
||||
cProtocol_1_11_0::cProtocol_1_11_0(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
|
||||
super(a_Client, a_ServerAddress, a_ServerPort, a_State)
|
||||
{
|
||||
}
|
||||
@ -49,7 +49,7 @@ void cProtocol_1_11_0::SendCollectEntity(const cEntity & a_Entity, const cPlayer
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x0d); // Collect Item packet
|
||||
cPacketizer Pkt(*this, 0x48); // Collect Item packet
|
||||
Pkt.WriteVarInt32(a_Entity.GetUniqueID());
|
||||
Pkt.WriteVarInt32(a_Player.GetUniqueID());
|
||||
Pkt.WriteVarInt32(static_cast<UInt32>(a_Count));
|
||||
@ -87,12 +87,15 @@ void cProtocol_1_11_0::SendSpawnMob(const cMonster & a_Mob)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
cPacketizer Pkt(*this, 0x0f); // Spawn Mob packet
|
||||
cPacketizer Pkt(*this, 0x03); // Spawn Mob packet
|
||||
Pkt.WriteVarInt32(a_Mob.GetUniqueID());
|
||||
// TODO: Bad way to write a UUID, and it's not a true UUID, but this is functional for now.
|
||||
Pkt.WriteBEUInt64(0);
|
||||
Pkt.WriteBEUInt64(a_Mob.GetUniqueID());
|
||||
Pkt.WriteVarInt32(static_cast<UInt32>(a_Mob.GetMobType()));
|
||||
Pkt.WriteFPInt(a_Mob.GetPosX());
|
||||
Pkt.WriteFPInt(a_Mob.GetPosY());
|
||||
Pkt.WriteFPInt(a_Mob.GetPosZ());
|
||||
Pkt.WriteBEDouble(a_Mob.GetPosX());
|
||||
Pkt.WriteBEDouble(a_Mob.GetPosY());
|
||||
Pkt.WriteBEDouble(a_Mob.GetPosZ());
|
||||
Pkt.WriteByteAngle(a_Mob.GetPitch());
|
||||
Pkt.WriteByteAngle(a_Mob.GetHeadYaw());
|
||||
Pkt.WriteByteAngle(a_Mob.GetYaw());
|
||||
@ -100,7 +103,7 @@ void cProtocol_1_11_0::SendSpawnMob(const cMonster & a_Mob)
|
||||
Pkt.WriteBEInt16(static_cast<Int16>(a_Mob.GetSpeedY() * 400));
|
||||
Pkt.WriteBEInt16(static_cast<Int16>(a_Mob.GetSpeedZ() * 400));
|
||||
WriteEntityMetadata(Pkt, a_Mob);
|
||||
Pkt.WriteBEUInt8(0x7f); // Metadata terminator
|
||||
Pkt.WriteBEUInt8(0xff); // Metadata terminator
|
||||
}
|
||||
|
||||
|
||||
@ -187,3 +190,51 @@ void cProtocol_1_11_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
|
||||
|
||||
|
||||
|
||||
cProtocol_1_11_1::cProtocol_1_11_1(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
|
||||
super(a_Client, a_ServerAddress, a_ServerPort, a_State)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol_1_11_1::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
|
||||
{
|
||||
cServer * Server = cRoot::Get()->GetServer();
|
||||
AString ServerDescription = Server->GetDescription();
|
||||
int NumPlayers = Server->GetNumPlayers();
|
||||
int MaxPlayers = Server->GetMaxPlayers();
|
||||
AString Favicon = Server->GetFaviconData();
|
||||
cRoot::Get()->GetPluginManager()->CallHookServerPing(*m_Client, ServerDescription, NumPlayers, MaxPlayers, Favicon);
|
||||
|
||||
// Version:
|
||||
Json::Value Version;
|
||||
Version["name"] = "Cuberite 1.11.1";
|
||||
Version["protocol"] = cProtocolRecognizer::PROTO_VERSION_1_11_1;
|
||||
|
||||
// Players:
|
||||
Json::Value Players;
|
||||
Players["online"] = NumPlayers;
|
||||
Players["max"] = MaxPlayers;
|
||||
// TODO: Add "sample"
|
||||
|
||||
// Description:
|
||||
Json::Value Description;
|
||||
Description["text"] = ServerDescription.c_str();
|
||||
|
||||
// Create the response:
|
||||
Json::Value ResponseValue;
|
||||
ResponseValue["version"] = Version;
|
||||
ResponseValue["players"] = Players;
|
||||
ResponseValue["description"] = Description;
|
||||
if (!Favicon.empty())
|
||||
{
|
||||
ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str());
|
||||
}
|
||||
|
||||
// Serialize the response into a packet:
|
||||
Json::FastWriter Writer;
|
||||
cPacketizer Pkt(*this, 0x00); // Response packet
|
||||
Pkt.WriteString(Writer.write(ResponseValue));
|
||||
}
|
||||
|
@ -39,3 +39,18 @@ protected:
|
||||
virtual void HandlePacketBlockPlace (cByteBuffer & a_ByteBuffer) override;
|
||||
virtual void HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class cProtocol_1_11_1 :
|
||||
public cProtocol_1_11_0
|
||||
{
|
||||
typedef cProtocol_1_11_0 super;
|
||||
|
||||
public:
|
||||
cProtocol_1_11_1(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State);
|
||||
|
||||
virtual void HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) override;
|
||||
};
|
||||
|
@ -4082,7 +4082,7 @@ void cProtocol_1_9_0::WriteEntityProperties(cPacketizer & a_Pkt, const cEntity &
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cProtocol_1_9_1:
|
||||
|
||||
cProtocol_1_9_1::cProtocol_1_9_1(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
|
||||
cProtocol_1_9_1::cProtocol_1_9_1(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
|
||||
super(a_Client, a_ServerAddress, a_ServerPort, a_State)
|
||||
{
|
||||
}
|
||||
@ -4174,7 +4174,7 @@ void cProtocol_1_9_1::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cProtocol_1_9_2:
|
||||
|
||||
cProtocol_1_9_2::cProtocol_1_9_2(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
|
||||
cProtocol_1_9_2::cProtocol_1_9_2(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
|
||||
super(a_Client, a_ServerAddress, a_ServerPort, a_State)
|
||||
{
|
||||
}
|
||||
@ -4231,7 +4231,7 @@ void cProtocol_1_9_2::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cProtocol_1_9_4:
|
||||
|
||||
cProtocol_1_9_4::cProtocol_1_9_4(cClientHandle * a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
|
||||
cProtocol_1_9_4::cProtocol_1_9_4(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
|
||||
super(a_Client, a_ServerAddress, a_ServerPort, a_State)
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user