#pragma once #include #include "Packet.hpp" enum ConnectionState : unsigned char { Handshaking, Login, Play, Status, }; class Network { std::unique_ptr socket; std::unique_ptr stream; std::shared_ptr ReceivePacketByPacketId(int packetId, ConnectionState state, StreamInput &stream); public: Network(std::string address, unsigned short port); ~Network(); std::shared_ptr ReceivePacket(ConnectionState state = Play, bool useCompression = false); void SendPacket(Packet &packet, int compressionThreshold = -1); std::shared_ptr ParsePacketPlay(PacketNamePlayCB id); };