#pragma once #include "../../Level/Storage/SavedData.h" class Villages : public SavedData { public: static const std::wstring VILLAGE_FILE_ID; static const int MaxDoorDist = 32; private: Level* level; std::deque queries; std::vector > unclustered; std::vector > villages; int _tick; public: Villages(const std::wstring& id); Villages(Level* level); ~Villages(); void setLevel(Level* level); void queryUpdateAround(int x, int y, int z); void tick(); private: void removeVillages(); public: std::vector >* getVillages(); std::shared_ptr getClosestVillage(int x, int y, int z, int maxDist); private: void processNextQuery(); void cluster(); void addDoorInfos(Pos* pos); std::shared_ptr getDoorInfo(int x, int y, int z); void createDoorInfo(int x, int y, int z); bool hasQuery(int x, int y, int z); bool isDoor(int x, int y, int z); public: void load(CompoundTag* tag); void save(CompoundTag* tag); };