43 enum class VillageVersion : uchar {
45 WorksiteInitEventFix = 1,
53 ::ll::TypedStorage<8, 8, ::Tick> mLastTicked;
54 ::ll::TypedStorage<4, 12, ::BlockPos> mLastSavedPosition;
62 MCAPI
static int const& GOLEM_DEATH_PENALTY();
64 MCAPI
static int const& LARGE_PENALTY();
66 MCAPI
static int const& LARGE_REWARD();
68 MCAPI
static int const& MEDIUM_PENALTY();
70 MCAPI
static int const& SMALL_PENALTY();
72 MCAPI
static int const& SMALL_REWARD();
76 using ClaimedPOIList = ::std::unordered_map<::ActorUniqueID, ::std::array<::std::weak_ptr<::POIInstance>, 3>>;
78 using DwellerMap = ::std::unordered_map<::ActorUniqueID, ::Village::DwellerData>;
80 using DwellerTimestamp = ::std::pair<::ActorUniqueID, ::Tick>;
82 using UnclaimedPOIList = ::std::array<::std::vector<::std::weak_ptr<::POIInstance>>, 3>;
87 ::ll::TypedStorage<8, 16, ::mce::UUID> mUniqueID;
88 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
89 ::ll::TypedStorage<8, 72, ::std::array<::std::vector<::std::weak_ptr<::POIInstance>>, 3>> mUnclaimedPOIStacks;
90 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ActorUniqueID, ::std::array<::std::weak_ptr<::POIInstance>, 3>>>
92 ::ll::TypedStorage<8, 256, ::std::array<::std::unordered_map<::ActorUniqueID, ::Village::DwellerData>, 4>>
94 ::ll::TypedStorage<4, 24, ::AABB> mBounds;
95 ::ll::TypedStorage<4, 24, ::AABB> mStaticRaidBounds;
96 ::ll::TypedStorage<1, 1, uchar> mVillageVersion;
97 ::ll::TypedStorage<8, 8, ::Tick> mGameTick;
98 ::ll::TypedStorage<8, 8, ::Tick> mSaveTick;
99 ::ll::TypedStorage<8, 8, ::Tick> mRingTick;
100 ::ll::TypedStorage<8, 8, ::Tick> mNoBreedTimer;
101 ::ll::TypedStorage<8, 8, ::Tick> mBadStandingDecayTimer;
102 ::ll::TypedStorage<8, 8, ::Tick> mGoodStandingDecayTimer;
103 ::ll::TypedStorage<8, 8, ::Tick> mPassiveDwellerSpawnTimer;
104 ::ll::TypedStorage<4, 4, int> mInitializationTimer;
105 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ActorUniqueID, int>> mPlayerStanding;
106 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ActorUniqueID, ::Village::DwellerData>> mAggressors;
107 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<::ActorUniqueID, ::Tick>>> mVillagerWorkTimestamps;
108 ::ll::TypedStorage<1, 1, bool> mVillageInitialized;
109 ::ll::TypedStorage<8, 48, ::HashedString const> mNitwitFamily;
110 ::ll::TypedStorage<8, 48, ::HashedString const> mVillagePrefix;
111 ::ll::TypedStorage<8, 48, ::HashedString const> mVillagePrefixOld;
112 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Raid>> mRaid;
113 ::ll::TypedStorage<8, 64, ::std::unordered_set<::ActorUniqueID>> mSoundTheAlarmPlayerList;
118 Village& operator=(Village
const&);
119 Village(Village
const&);
127 MCAPI
void _applyHeroOfTheVillageEffect(
::ActorUniqueID const& actorID);
129 MCAPI
void _calcPOIDist();
131 MCAPI
bool _chooseRaidSpawnPosition(uint64 timesCalled,
::Vec3& outSpawnPoint)
const;
133 MCAPI ::Vec3 _chooseRandomDirectionFromVillage(
::Random& random)
const;
135 MCAPI
void _claimUnclaimedPOIs();
139 MCAPI
void _createRaid();
143 MCAPI
bool _findPlayerCentricSpawnPointForRaid(
::Vec3& outSpawnPoint,
bool snapToSurface)
const;
145 MCAPI
bool _findSpawnPointForRaid(
147 float distanceTolerance,
150 bool outsideOfVillage
154 _findSpawnableRegion(
::Vec3 spawnPosition,
int xzSpreadDistance,
bool& outHasSpawnAreaLoaded)
const;
156 MCAPI
void _findWeightedPOI(
157 ::std::vector<::std::weak_ptr<::POIInstance>>& unclaimedPOIStack,
162 MCAPI
void _helpLocateRaiders(
::Raid const& raid);
170 MCAPI
void _loadVillagePlayerStanding(
::CompoundTag const& tag);
172 MCAPI
void _playSoundFrom(
::Vec3 const& soundOrigin, ::SharedTypes::Legacy::LevelSoundEvent sound);
174 MCAPI
void _readyRaidGroup(::std::unordered_set<::ActorUniqueID>& spawnedMobs);
180 MCAPI
void _saveVillageDwellers(
::LevelStorage& levelStorage)
const;
186 MCAPI
void _saveVillagePlayerStanding(
::LevelStorage& levelStorage)
const;
190 MCAPI
void _spawnPassiveDwellers(
::BlockSource& region,
int);
193 _spawnRaidGroup(
::Vec3 spawnPosition, uchar groupNumber, ::std::unordered_set<::ActorUniqueID>& spawnedMobs)
const;
195 MCAPI
void _tryAddPoiToVillage(
::ActorUniqueID const& villager, ::std::weak_ptr<::POIInstance> pi);
197 MCAPI
void _tryShiftStandingsTowardNeutral(
::Tick& updateTick, uint64 updateInterval,
bool positiveShift);
199 MCAPI
void _trySpawnDefenderDwellers(
::BlockSource& region, uint64 bedCount);
201 MCAPI
void _updateAndRemoveInactiveDwellers(uint64 villagerPurgeTime,
float villageBorderTolerance);
207 MCAPI
void addActorToVillage(::DwellerRole role,
::ActorUniqueID const& actorID);
209 MCAPI
void addAggressor(
::Mob const& mob);
211 MCAPI
bool addPOI(::std::weak_ptr<::POIInstance> pi);
215 MCAPI
bool canRemove()
const;
217 MCAPI
bool checkNeedMoreVillagers()
const;
219 MCAPI
void clearOwnedPOIs();
221 MCAPI
void debugDraw();
223 MCAPI ::std::weak_ptr<::POIInstance> fetchOwnedPOI(
::ActorUniqueID const&
id, ::POIType type);
225 MCAPI
void fireSoundTheAlarm();
227 MCFOLD ::AABB
const& getBounds()
const;
229 MCAPI ::Vec3 getCenter()
const;
231 MCAPI ::Actor* getClosestAggressor(
::Actor* from);
233 MCAPI ::Player* getClosestBadStandingPlayer(
::Actor& from);
235 MCAPI ::std::weak_ptr<::POIInstance> getClosestPOI(::POIType type,
::BlockPos const& position);
237 MCAPI uint64 getPOICount()
const;
239 MCFOLD ::Raid
const* getRaid()
const;
241 MCFOLD ::AABB
const& getRaidBounds()
const;
243 MCFOLD ::Raid* getRaidMutable();
245 MCFOLD ::mce::UUID getUniqueID()
const;
247 MCAPI
bool hasInvalidRole(
::ActorUniqueID const& actorId, ::DwellerRole
const& role);
249 MCAPI
bool hasRaid()
const;
251 MCAPI
bool hasSpecificDweller(::DwellerRole role,
::ActorUniqueID const&
id)
const;
253 MCAPI
void loadDataByKey(::std::string
const& key,
::CompoundTag const& tag);
257 MCAPI ::std::_List_iterator<
258 ::std::_List_val<::std::_List_simple_types<::std::pair<::ActorUniqueID const, ::Village::DwellerData>>>>
259 removeActorFromVillage(::DwellerRole role,
::ActorUniqueID const& actor);
261 MCAPI
void removeAllInstancesofActorFromVillage(
::ActorUniqueID const& actor);
263 MCAPI
void removeVillageSavedData();
265 MCAPI
void resetDwellerTimer(::DwellerRole role,
::ActorUniqueID const&
id);
267 MCAPI
void resetNoBreedTimer();
269 MCAPI
void rewardAllPlayers(
int deltaAmount);
275 MCAPI
void tickRaid(
::Tick gameTick);
277 MCAPI
void triggerRaid();
281 MCAPI
void unlinkMismatchedJobsites(
::Actor const& villager);
285 MCAPI
bool withinVillageBounds(
::Vec3 const& pos,
float tolerance)
const;
293 MCAPI
static void _cleanupUnclaimedPOIStack(::std::vector<::std::weak_ptr<::POIInstance>>& unclaimedPOIStack);
295 MCAPI static ::std::shared_ptr<::POIInstance> _findPreferredPOI(
296 ::std::vector<::std::weak_ptr<::POIInstance>>& unclaimedPOIStack,
300 MCAPI
static bool isValidBedPOI(
::Block const& block);
310 MCAPI static ::std::string
const& CELEBRATION_EVENT();
312 MCAPI
static bool& DEBUG_DRAWING();
314 MCAPI static ::std::string
const& RAID_EXPIRY_EVENT();
316 MCAPI static ::std::string
const& STORAGE_KEY_PREFIX();