Add clientbound status packet types

This commit is contained in:
DankParrot 2020-07-31 18:52:24 -07:00
parent 8563f6c96f
commit c19b051bee
2 changed files with 15 additions and 2 deletions

View File

@ -13,5 +13,18 @@ namespace Feather
Ping = 1
};
enum class ClientBoundStatusPacketId : int32_t
{
Response = 0,
Pong = 1
};
enum class ServerboundLoginPacketId : int32_t
{
LoginStart = 0,
EncryptionResponse = 1,
LoginPluginResponse = 2
};
constexpr uint8_t LegacyServerListPing = 0xFE;
}

View File

@ -62,7 +62,7 @@ namespace Feather
NetworkMessage msg(VARINT_MAX_SIZE + status.length());
// Packet ID
msg.WriteVarInt(0);
msg.WriteVarInt(ClientBoundStatusPacketId::Response);
// JSON Contents
msg.WriteString(status.c_str(), static_cast<int32_t>(status.length()));
msg.Finalize();
@ -77,7 +77,7 @@ namespace Feather
NetworkMessage msg(VARINT_MAX_SIZE + sizeof(int64_t));
msg.WriteVarInt(1);
msg.WriteVarInt(ClientBoundStatusPacketId::Pong);
msg.Write<uint64_t>(timestamp);
msg.Finalize();