LeviLamina
Loading...
Searching...
No Matches
TickingAreasManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/NonOwnerPointer.h"
7#include "mc/deps/core/utility/pub_sub/Subscription.h"
8#include "mc/platform/UUID.h"
9#include "mc/util/Bounds.h"
10#include "mc/world/level/dimension/DimensionType.h"
11#include "mc/world/level/ticking/AddTickingAreaStatus.h"
12#include "mc/world/level/ticking/TickingAreaLoadMode.h"
13
14// auto generated forward declare list
15// clang-format off
16class Actor;
17class BlockPos;
18class CompoundTag;
21class Level;
22class LevelStorage;
23class TickingAreaList;
24struct ActorUniqueID;
25struct PendingArea;
26struct Tick;
28// clang-format on
29
30class TickingAreasManager {
31public:
32 // TickingAreasManager inner types declare
33 // clang-format off
34 struct ScopedContext;
35 // clang-format on
36
37 // TickingAreasManager inner types define
38 enum class AreaLimitCheck : int {
39 None = 0,
40 ActiveStandalone = 1,
41 ActiveAndPendingStandalone = 2,
42 };
43
45 public:
46 // member variables
47 // NOLINTBEGIN
48 ::ll::TypedStorage<8, 16, ::mce::UUID> mUuid;
49 ::ll::TypedStorage<8, 32, ::std::string> mName;
50 ::ll::TypedStorage<4, 48, ::Bounds> mBounds;
51 ::ll::TypedStorage<1, 1, bool> mFinishedLoading;
52 ::ll::TypedStorage<1, 1, bool> mIsActive;
53 // NOLINTEND
54
55 public:
56 // member functions
57 // NOLINTBEGIN
58 MCAPI ~ScopedContext();
59 // NOLINTEND
60
61 public:
62 // destructor thunk
63 // NOLINTBEGIN
64 MCFOLD void $dtor();
65 // NOLINTEND
66 };
67
68 using ActivePerDimension = ::std::map<::DimensionType, ::std::shared_ptr<::TickingAreaList>>;
69
70 using PendingPerDimension = ::std::unordered_map<::DimensionType, ::std::vector<::PendingArea>>;
71
72public:
73 // member variables
74 // NOLINTBEGIN
75 ::ll::TypedStorage<8, 16, ::std::map<::DimensionType, ::std::shared_ptr<::TickingAreaList>>> mActiveAreas;
76 ::ll::TypedStorage<8, 64, ::std::unordered_map<::DimensionType, ::std::vector<::PendingArea>>> mPendingAreas;
77 ::ll::TypedStorage<1, 1, bool> mIsPreloadDone;
78 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::LevelStorage> const> mLevelStorage;
79 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mPostReloadActorAdded;
80 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnCanStartGameSaveTimerCheckSubscription;
81 // NOLINTEND
82
83public:
84 // prevent constructor by default
85 TickingAreasManager();
86
87public:
88 // member functions
89 // NOLINTBEGIN
90 MCAPI explicit TickingAreasManager(::Bedrock::NonOwnerPointer<::LevelStorage> levelStorage);
91
92 MCAPI ::AddTickingAreaStatus _addArea(
93 ::DimensionType dimensionId,
94 ::std::string const& name,
95 ::Bounds const& bounds,
96 bool isCircle,
97 ::TickingAreasManager::AreaLimitCheck limitCheck,
98 bool isPersistent,
99 ::TickingAreaLoadMode loadMode,
100 ::LevelStorage& levelStorage
101 );
102
103 MCAPI void _deletePendingArea(::LevelStorage& levelStorage, ::PendingArea const& pendingArea);
104
105 MCAPI ::std::string _findUsableDefaultName(
106 ::TickingAreaList const& tickingAreaList,
107 ::std::vector<::PendingArea> const& pendingAreas
108 ) const;
109
110 MCAPI ::std::vector<::TickingAreaDescription> _getPendingAreaDescriptionsFiltered(
111 ::DimensionType dimensionId,
112 ::std::function<bool(::PendingArea const&)> includeInList
113 ) const;
114
115 MCAPI void _postReloadActorAdded(::Actor& actor);
116
117 MCAPI void _processAdds(::Level& level);
118
119 MCAPI void
120 _processRemoves(::DimensionType dimensionId, ::TickingAreaList& list, ::Level& level, ::LevelStorage& levelStorage);
121
122 MCAPI void
123 _savePendingArea(::LevelStorage& levelStorage, ::DimensionType dimensionId, ::PendingArea const& pendingArea);
124
125 MCAPI ::AddTickingAreaStatus addArea(
126 ::DimensionType dimensionId,
127 ::std::string const& name,
128 ::BlockPos const& center,
129 int radius,
130 ::TickingAreasManager::AreaLimitCheck limitCheck,
131 bool isPersistent,
132 ::TickingAreaLoadMode loadMode,
133 ::LevelStorage& levelStorage
134 );
135
136 MCAPI ::AddTickingAreaStatus addArea(
137 ::DimensionType dimensionId,
138 ::std::string const& name,
139 ::BlockPos const& min,
140 ::BlockPos const& max,
141 ::TickingAreasManager::AreaLimitCheck limitCheck,
142 bool isPersistent,
143 ::TickingAreaLoadMode loadMode,
144 ::LevelStorage& levelStorage
145 );
146
147 MCAPI void addEntityArea(::DimensionType dimensionId, ::Actor const& actor, ::LevelStorage& levelStorage);
148
149 MCAPI void addEntityArea(
150 ::DimensionType dimensionId,
151 ::ActorUniqueID const& entityId,
152 ::Bounds bounds,
153 bool alwaysActive,
154 float maxDistToPlayers,
155 ::LevelStorage& levelStorage
156 );
157
158 MCAPI void addTickingAreaListForDimension(
159 ::DimensionType dimensionId,
160 ::std::shared_ptr<::TickingAreaList> const& tickingAreaList
161 );
162
163 MCAPI ::TickingAreasManager::ScopedContext addTransientScopedArea(
164 ::DimensionType dimensionId,
165 ::std::string const& name,
166 uint64 scopeKey,
167 ::mce::UUID uuid,
168 ::Bounds const& bounds
169 );
170
171 MCAPI uint countStandaloneTickingAreas() const;
172
173 MCAPI ::std::vector<::TickingAreaDescription>
174 getPendingStandaloneAreaDescriptions(::DimensionType dimensionId) const;
175
176 MCAPI ::std::vector<::TickingAreaDescription>
177 getPendingStandaloneAreaDescriptionsByName(::DimensionType dimensionId, ::std::string const& name) const;
178
179 MCAPI ::std::vector<::TickingAreaDescription>
180 getPendingStandaloneAreaDescriptionsByPosition(::DimensionType dimensionId, ::BlockPos const& position) const;
181
182 MCFOLD bool isPreloadDone() const;
183
184 MCAPI void loadArea(::std::string const& key, ::CompoundTag const* tag);
185
186 MCAPI void loadAreasFromSaveData(::LevelStorage& levelStorage);
187
188 MCAPI void onTickingEntityAdded(::DimensionType dimensionId, ::Actor& actor, ::LevelStorage& levelStorage);
189
190 MCAPI void registerForActorManagerEvents(::IActorManagerConnector& actorManagerConnector);
191
192 MCAPI void registerForLevelStorageManagerEvents(::ILevelStorageManagerConnector& levelStorageManagerConnector);
193
194 MCAPI ::std::vector<::TickingAreaDescription>
195 removePendingAreaByName(::DimensionType dimensionId, ::std::string const& name, ::LevelStorage& levelStorage);
196
197 MCAPI ::std::vector<::TickingAreaDescription>
198 removePendingAreaByPosition(::DimensionType dimensionId, ::BlockPos const& position, ::LevelStorage& levelStorage);
199
200 MCAPI void removeScopedAreas(::std::vector<::mce::UUID> const& uuids);
201
202 MCAPI ::std::vector<::TickingAreaDescription> setPendingAreaLoadModeByName(
203 ::DimensionType dimensionId,
204 ::std::string const& name,
205 ::TickingAreaLoadMode loadMode,
206 ::LevelStorage& levelStorage
207 );
208
209 MCAPI ::std::vector<::TickingAreaDescription> setPendingAreaLoadModeByPosition(
210 ::DimensionType dimensionId,
211 ::BlockPos const& position,
212 ::TickingAreaLoadMode loadMode,
213 ::LevelStorage& levelStorage
214 );
215
216 MCAPI void tick(::Tick const& currentTick);
217
218 MCAPI void update(::Level& level, ::LevelStorage& levelStorage);
219
220 MCAPI ~TickingAreasManager();
221 // NOLINTEND
222
223public:
224 // static functions
225 // NOLINTBEGIN
226 MCAPI static ::TickingAreasManager::AreaLimitCheck getLimitCheck(::Level const& level, bool enforce);
227 // NOLINTEND
228
229public:
230 // constructor thunks
231 // NOLINTBEGIN
232 MCAPI void* $ctor(::Bedrock::NonOwnerPointer<::LevelStorage> levelStorage);
233 // NOLINTEND
234
235public:
236 // destructor thunk
237 // NOLINTBEGIN
238 MCAPI void $dtor();
239 // NOLINTEND
240};
Definition Actor.h:125
Definition NonOwnerPointer.h:9
Definition BlockPos.h:21
Definition CompoundTag.h:23
Definition IActorManagerConnector.h:14
Definition ILevelStorageManagerConnector.h:13
Definition LevelStorage.h:26
Definition Level.h:255
Definition TickingAreaList.h:15
Definition UUID.h:7
Definition ActorUniqueID.h:10
Definition Bounds.h:8
Definition DimensionType.h:5
Definition PendingArea.h:18
Definition Tick.h:5
Definition TickingAreaDescription.h:9
Definition TickingAreasManager.h:44