Sucessfully send Login Success!!!
This commit is contained in:
parent
2e8ed73cc8
commit
5c0333a192
|
@ -26,5 +26,14 @@ namespace Feather
|
|||
LoginPluginResponse = 2
|
||||
};
|
||||
|
||||
enum class ClientboundLoginPacketId : int32_t
|
||||
{
|
||||
Disconnect = 0,
|
||||
EncryptionRequest = 1,
|
||||
LoginSuccess = 2,
|
||||
SetCompression = 3,
|
||||
LoginPluginRequest = 4
|
||||
};
|
||||
|
||||
constexpr uint8_t LegacyServerListPing = 0xFE;
|
||||
}
|
||||
|
|
|
@ -91,8 +91,37 @@ namespace Feather
|
|||
|
||||
case ProtocolState::Login:
|
||||
{
|
||||
int id = packet.ReadVarInt();
|
||||
Log_Info("Login packet ID %d", id);
|
||||
auto id = packet.ReadVarInt<ServerboundLoginPacketId>();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case ServerboundLoginPacketId::LoginStart:
|
||||
{
|
||||
std::string username = packet.ReadString();
|
||||
std::string uuid = "ecb99913-96a8-40a7-8529-a2ca6ad95768";
|
||||
|
||||
uuid.resize(36);
|
||||
username.resize(16);
|
||||
|
||||
NetworkMessage msg(VARINT_MAX_SIZE * 3 + uuid.length() + username.length());
|
||||
|
||||
msg.WriteVarInt(ClientboundLoginPacketId::LoginSuccess);
|
||||
// UUID 1.16.1
|
||||
msg.Write<uint64_t>(4658857991808325907LL);
|
||||
msg.Write<uint64_t>(7518717155607718277LL);
|
||||
|
||||
// UUID 1.15.2
|
||||
//msg.WriteString(uuid.c_str(), uuid.length());
|
||||
|
||||
msg.WriteString(username.c_str(), username.length());
|
||||
msg.Finalize();
|
||||
|
||||
client.SendMessage(msg);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue