LeviLamina
Loading...
Searching...
No Matches
VillageManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/world/actor/ai/village/IVillageManager.h"
7#include "mc/world/actor/ai/village/POIType.h"
8
9// auto generated forward declare list
10// clang-format off
11class Block;
12class BlockLegacy;
13class BlockPos;
14class BlockSource;
15class Dimension;
16class HashedString;
18class LevelStorage;
19class POIInstance;
20class Village;
22struct ActorUniqueID;
23struct EffectDuration;
24struct POIBlueprint;
25struct Tick;
26namespace Bedrock::PubSub { class Subscription; }
27namespace mce { class UUID; }
28// clang-format on
29
31public:
32 // VillageManager inner types declare
33 // clang-format off
35 struct VillageInfo;
36 // clang-format on
37
38 // VillageManager inner types define
39 using POIBlueprintMap = ::std::unordered_map<::BlockLegacy const*, ::std::unique_ptr<::POIBlueprint>>;
40
41 using VillageMap = ::std::unordered_map<::mce::UUID, ::std::shared_ptr<::Village>>;
42
43 using POIMap = ::std::unordered_map<::BlockPos, ::std::shared_ptr<::POIInstance>>;
44
45 enum class BedAvailabilityState : int {
46 Unknown = 0,
47 SomeAvailable = 1,
48 NoneAvailable = 2,
49 };
50
51 struct VillageInfo {
52 public:
53 // member variables
54 // NOLINTBEGIN
55 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::Village>> village;
56 ::ll::TypedStorage<1, 1, bool> positionIsWithinVillageBounds;
57 ::ll::TypedStorage<4, 4, float> distanceToClosestEdgeOfVillage;
58 // NOLINTEND
59 };
60
62 public:
63 // member variables
64 // NOLINTBEGIN
65 ::ll::TypedStorage<4, 4, ::VillageManager::BedAvailabilityState> bedAvailability;
66 // NOLINTEND
67
68 public:
69 // member functions
70 // NOLINTBEGIN
72 // NOLINTEND
73
74 public:
75 // destructor thunk
76 // NOLINTBEGIN
77 MCFOLD void $dtor();
78 // NOLINTEND
79 };
80
81public:
82 // member variables
83 // NOLINTBEGIN
84 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
85 ::ll::TypedStorage<8, 40, ::std::deque<::ActorUniqueID>> mFindPOIQueries;
86 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::POIInstance>>> mUnclusteredPOIs;
87 ::ll::TypedStorage<8, 64, ::std::unordered_map<::mce::UUID, ::std::shared_ptr<::Village>>> mVillages;
88 ::ll::TypedStorage<8, 192, ::std::array<::std::unordered_map<::BlockPos, ::std::shared_ptr<::POIInstance>>, 3>>
89 mClusteredPOIs;
90 ::ll::TypedStorage<8, 64, ::std::unordered_map<::BlockLegacy const*, ::std::unique_ptr<::POIBlueprint>>>
91 mPOIBlueprints;
92 ::ll::TypedStorage<8, 8, ::Tick> mTickCount;
93 ::ll::TypedStorage<8, 32, ::WanderingTraderScheduler> mWanderingTraderScheduler;
94 ::ll::TypedStorage<1, 1, bool> mFinishedQueryScan;
95 ::ll::TypedStorage<4, 4, int> mCurrentXScan;
96 ::ll::TypedStorage<4, 4, int> mCurrentYScan;
97 ::ll::TypedStorage<4, 4, int> mCurrentZScan;
98 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnSaveSubscription;
99 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnLevelStorageManagerStartLeaveGameSubscription;
100 // NOLINTEND
101
102public:
103 // virtual functions
104 // NOLINTBEGIN
105 // vIndex: 0
106 virtual ~VillageManager() /*override*/ = default;
107
108 // vIndex: 1
109 virtual ::std::weak_ptr<::Village>
110 fetchClosestVillage(::BlockPos const& position, int maxDistFromVillageBounds, uint searchRadius) const /*override*/;
111
112 // vIndex: 2
113 virtual ::std::weak_ptr<::Village> getVillageByID(::mce::UUID const& villageID) const /*override*/;
114 // NOLINTEND
115
116public:
117 // member functions
118 // NOLINTBEGIN
119 MCAPI explicit VillageManager(::Dimension& dimension);
120
121 MCAPI void _addPOIWithinRadius(::BlockPos const& pos, ::BlockSource& region);
122
123 MCAPI void _assignPOIOnly(::std::shared_ptr<::POIInstance>&& pi);
124
125 MCAPI float
126 _calculateDistanceFromPositionToEdgeOfVillage(::BlockPos const& position, ::Village const& village) const;
127
128 MCAPI ::std::shared_ptr<::Village> _createOrGetVillage(::mce::UUID const& id, ::BlockPos const& newVillagePos);
129
130 MCAPI ::std::unordered_map<::Village const*, ::VillageManager::BedAvailabilityState>
131 _getVillageWithBedsAvailableMap() const;
132
133 MCAPI void _loadPOIBlueprints();
134
135 MCAPI void _processNextUnclusteredPOIQuery();
136
137 MCAPI void _removeEligibleVillages();
138
139 MCAPI void _removeVillage(::Village& village);
140
141 MCAPI void _saveAllVillages(::LevelStorage& levelStorage);
142
143 MCAPI void _tryAssignPOIOrCreateVillage(::std::shared_ptr<::POIInstance>&& pi);
144
145 MCAPI void _unclusterDerelictPOIs(::std::vector<::std::weak_ptr<::POIInstance>>& pois);
146
147 MCAPI ::std::weak_ptr<::Village> fetchClosestVillageMostSuitableForDweller(
148 ::BlockPos const& position,
149 int maxDistFromVillageBounds,
150 uint searchRadius
151 ) const;
152
153 MCAPI ::std::weak_ptr<::Village> getClosestVillageWithRaid(::BlockPos const& pos);
154
155 MCAPI ::std::weak_ptr<::POIInstance> getPOI(::BlockPos const& position) const;
156
157 MCAPI ::HashedString getPOIInitEventFromName(::HashedString const& name) const;
158
159 MCAPI ::HashedString const& getPOINameFromBlueprint(::Block const& block) const;
160
161 MCAPI bool hasPOI(::BlockPos const& position, ::POIType type) const;
162
163 MCAPI void initializeWithLevelStorageManagerConnector(::ILevelStorageManagerConnector& levelStorageManagerConnector
164 );
165
166 MCAPI void insertPOI(::std::shared_ptr<::POIInstance>&& poi);
167
168 MCAPI bool isValidPOIType(::BlockPos const& pos, ::Block const& block) const;
169
170 MCAPI void removePOI(::std::weak_ptr<::POIInstance> poi);
171
172 MCAPI ::std::shared_ptr<::POIInstance> tryCreatePOI(::BlockPos const& position, ::Block const& block);
173 // NOLINTEND
174
175public:
176 // static variables
177 // NOLINTBEGIN
178 MCAPI static int const& MAX_POI_TOLERANCE_DIST();
179
180 MCAPI static ::EffectDuration const& VILLAGE_HERO_EFFECT_DURATION();
181 // NOLINTEND
182
183public:
184 // constructor thunks
185 // NOLINTBEGIN
186 MCAPI void* $ctor(::Dimension& dimension);
187 // NOLINTEND
188
189public:
190 // destructor thunk
191 // NOLINTBEGIN
192
193 // NOLINTEND
194
195public:
196 // virtual function thunks
197 // NOLINTBEGIN
198 MCAPI ::std::weak_ptr<::Village>
199 $fetchClosestVillage(::BlockPos const& position, int maxDistFromVillageBounds, uint searchRadius) const;
200
201 MCAPI ::std::weak_ptr<::Village> $getVillageByID(::mce::UUID const& villageID) const;
202 // NOLINTEND
203
204public:
205 // vftables
206 // NOLINTBEGIN
207 MCAPI static void** $vftable();
208 // NOLINTEND
209};
Definition BlockLegacy.h:88
Definition BlockPos.h:18
Definition BlockSource.h:67
Definition Block.h:36
Definition Dimension.h:83
Definition HashedString.h:5
Definition ILevelStorageManagerConnector.h:13
Definition IVillageManager.h:15
Definition LevelStorage.h:24
Definition POIInstance.h:19
Definition VillageManager.h:30
Definition Village.h:34
Definition WanderingTraderScheduler.h:12
Definition UUID.h:7
Definition ActorUniqueID.h:5
Definition EffectDuration.h:5
Definition POIBlueprint.h:13
Definition Tick.h:5
Definition VillageManager.h:61
Definition VillageManager.h:51