From 70c32d288fa2134c63c70964611da646fcdfe4e9 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Thu, 30 Jul 2020 04:36:24 +0500 Subject: Minor protocol support improvement --- src/Packet.hpp | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'src/Packet.hpp') diff --git a/src/Packet.hpp b/src/Packet.hpp index cca01ec..ccc486f 100644 --- a/src/Packet.hpp +++ b/src/Packet.hpp @@ -1169,3 +1169,64 @@ struct PacketRespawn : Packet { unsigned char Gamemode; std::string LevelType; }; + +struct PacketPluginMessageSB : Packet { + void ToStream(StreamOutput* stream) override { + stream->WriteString(Channel); + stream->WriteByteArray(Data); + } + + void FromStream(StreamInput* stream) override { + + } + + int GetPacketId() override { + return PacketNamePlaySB::PluginMessageSB; + } + + PacketPluginMessageSB(const std::string& channel, const std::vector data) : Channel(channel), Data(data) {} + + std::string Channel; + std::vector Data; +}; + +struct PacketClientSettings : Packet { + void ToStream(StreamOutput* stream) override { + stream->WriteString(Locale); + stream->WriteByte(ViewDistance); + stream->WriteVarInt(ChatMode); + stream->WriteBool(ChatColors); + stream->WriteUByte(DisplayedSkinParts); + stream->WriteVarInt(MainHand); + } + + void FromStream(StreamInput* stream) override { + + } + + int GetPacketId() override { + return PacketNamePlaySB::ClientSettings; + } + + PacketClientSettings( + const std::string locale, + unsigned char viewDistance, + int chatMode, + bool chatColors, + unsigned char displayedSkinParts, + int mainHand) : + Locale(locale), + ViewDistance(viewDistance), + ChatMode(chatMode), + ChatColors(chatColors), + DisplayedSkinParts(displayedSkinParts), + MainHand(mainHand) {} + + std::string Locale; + unsigned char ViewDistance; + int ChatMode; + bool ChatColors; + unsigned char DisplayedSkinParts; + int MainHand; +}; + -- cgit v1.2.3