+ bool HasPlayer() const noexcept { return player.entity; }
+ Entity &PlayerEntity() noexcept { return *player.entity; }
+ const Entity &PlayerEntity() const noexcept { return *player.entity; }
+ ChunkIndex &PlayerChunks() noexcept { return *player.chunks; }
+ const ChunkIndex &PlayerChunks() const noexcept { return *player.chunks; }
+
+private:
+ struct SpawnStatus {
+ // the entity in question
+ Entity *const entity = nullptr;
+ // sequence number of the spawn packet or -1 after it's been ack'd
+ std::int32_t spawn_pack = -1;
+ // sequence number of the despawn packet or -1 if no despawn has been sent
+ std::int32_t despawn_pack = -1;
+
+ explicit SpawnStatus(Entity &);
+ ~SpawnStatus();
+ };
+
+private:
+ void OnPacketReceived(std::uint16_t) override;
+ void OnPacketLost(std::uint16_t) override;