diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/Villages.h | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/Villages.h')
| -rw-r--r-- | Minecraft.World/Villages.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Minecraft.World/Villages.h b/Minecraft.World/Villages.h new file mode 100644 index 00000000..030edc33 --- /dev/null +++ b/Minecraft.World/Villages.h @@ -0,0 +1,47 @@ +#pragma once + +#include "SavedData.h" + +class Villages : public SavedData +{ +public: + static const wstring VILLAGE_FILE_ID; + + static const int MaxDoorDist = 32; + +private: + Level *level; + deque<Pos *> queries; + vector<shared_ptr<DoorInfo> > unclustered; + vector<shared_ptr<Village> > villages; + int _tick; + +public: + Villages(const wstring &id); + Villages(Level *level); + ~Villages(); + + void setLevel(Level *level); + void queryUpdateAround(int x, int y, int z); + void tick(); + +private: + void removeVillages(); + +public: + vector<shared_ptr<Village> > *getVillages(); + shared_ptr<Village> getClosestVillage(int x, int y, int z, int maxDist); + +private: + void processNextQuery(); + void cluster(); + void addDoorInfos(Pos *pos); + shared_ptr<DoorInfo>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); +};
\ No newline at end of file |
