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/AutomaticID.h"
7#include "mc/deps/core/utility/NonOwnerPointer.h"
8#include "mc/deps/core/utility/pub_sub/Subscription.h"
9#include "mc/world/level/ticking/AddTickingAreaStatus.h"
10#include "mc/world/level/ticking/TickingAreaLoadMode.h"
11
12// auto generated forward declare list
13// clang-format off
14class Actor;
15class BlockPos;
16class CompoundTag;
17class Dimension;
20class Level;
21class LevelStorage;
22class TickingAreaList;
23struct ActorUniqueID;
24struct Bounds;
25struct PendingArea;
27// clang-format on
28
30public:
31 // TickingAreasManager inner types define
32 enum class AreaLimitCheck : int {
33 None = 0,
34 ActiveStandalone = 1,
35 ActiveAndPendingStandalone = 2,
36 };
37
38 using ActivePerDimension = ::std::map<::DimensionType, ::std::shared_ptr<::TickingAreaList>>;
39
40 using PendingPerDimension = ::std::unordered_map<::DimensionType, ::std::vector<::PendingArea>>;
41
42public:
43 // member variables
44 // NOLINTBEGIN
45 ::ll::TypedStorage<8, 16, ::std::map<::DimensionType, ::std::shared_ptr<::TickingAreaList>>> mActiveAreas;
46 ::ll::TypedStorage<8, 64, ::std::unordered_map<::DimensionType, ::std::vector<::PendingArea>>> mPendingAreas;
47 ::ll::TypedStorage<1, 1, bool> mIsPreloadDone;
48 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::LevelStorage> const> mLevelStorage;
49 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mPostReloadActorAdded;
50 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnCanStartGameSaveTimerCheckSubscription;
51 // NOLINTEND
52
53public:
54 // prevent constructor by default
56
57public:
58 // member functions
59 // NOLINTBEGIN
61
62 MCAPI ::AddTickingAreaStatus _addArea(
63 ::DimensionType dimensionId,
64 ::std::string const& name,
65 ::Bounds const& bounds,
66 bool isCircle,
67 ::TickingAreasManager::AreaLimitCheck limitCheck,
68 bool isPersistent,
69 ::TickingAreaLoadMode loadMode,
70 ::LevelStorage& levelStorage
71 );
72
73 MCAPI void _deletePendingArea(::LevelStorage& levelStorage, ::PendingArea const& pendingArea);
74
75 MCAPI ::std::string _findUsableDefaultName(
76 ::TickingAreaList const& tickingAreaList,
77 ::std::vector<::PendingArea> const& pendingAreas
78 ) const;
79
80 MCAPI ::std::vector<::TickingAreaDescription> _getPendingAreaDescriptionsFiltered(
81 ::DimensionType dimensionId,
82 ::std::function<bool(::PendingArea const&)> includeInList
83 ) const;
84
85 MCAPI bool
86 _hasPendingTickingAreaNamed(::std::string const& name, ::std::vector<::PendingArea> const& dimensionAreas) const;
87
88 MCAPI void _postReloadActorAdded(::Actor& actor);
89
90 MCAPI void _processAdds(::Level& level);
91
92 MCAPI void
93 _processRemoves(::DimensionType dimensionId, ::TickingAreaList& list, ::Level& level, ::LevelStorage& levelStorage);
94
95 MCAPI void
96 _savePendingArea(::LevelStorage& levelStorage, ::DimensionType dimensionId, ::PendingArea const& pendingArea);
97
98 MCAPI ::AddTickingAreaStatus addArea(
99 ::DimensionType dimensionId,
100 ::std::string const& name,
101 ::BlockPos const& min,
102 ::BlockPos const& max,
103 ::TickingAreasManager::AreaLimitCheck limitCheck,
104 bool isPersistent,
105 ::TickingAreaLoadMode loadMode,
106 ::LevelStorage& levelStorage
107 );
108
109 MCAPI void addEntityArea(::DimensionType dimensionId, ::Actor const& actor, ::LevelStorage& levelStorage);
110
111 MCAPI void addEntityArea(
112 ::DimensionType dimensionId,
113 ::ActorUniqueID const& entityId,
114 ::Bounds const& bounds,
115 bool alwaysActive,
116 float maxDistToPlayers,
117 ::LevelStorage& levelStorage
118 );
119
120 MCAPI uint countActiveStandaloneTickingAreas() const;
121
122 MCAPI uint countStandaloneTickingAreas() const;
123
124 MCAPI void loadArea(::std::string const& key, ::CompoundTag const* tag);
125
126 MCAPI void onTickingEntityAdded(::DimensionType dimensionId, ::Actor& actor, ::LevelStorage& levelStorage);
127
128 MCAPI void registerForActorManagerEvents(::IActorManagerConnector& actorManagerConnector);
129
130 MCAPI void registerForLevelStorageManagerEvents(::ILevelStorageManagerConnector& levelStorageManagerConnector);
131
132 MCAPI ::std::vector<::TickingAreaDescription>
133 removePendingAreaByName(::DimensionType dimensionId, ::std::string const& name, ::LevelStorage& levelStorage);
134
135 MCAPI ::std::vector<::TickingAreaDescription>
136 removePendingAreaByPosition(::DimensionType dimensionId, ::BlockPos const& position, ::LevelStorage& levelStorage);
137
138 MCAPI ::std::vector<::TickingAreaDescription> setPendingAreaLoadModeByName(
139 ::DimensionType dimensionId,
140 ::std::string const& name,
141 ::TickingAreaLoadMode loadMode,
142 ::LevelStorage& levelStorage
143 );
144
145 MCAPI ::std::vector<::TickingAreaDescription> setPendingAreaLoadModeByPosition(
146 ::DimensionType dimensionId,
147 ::BlockPos const& position,
148 ::TickingAreaLoadMode loadMode,
149 ::LevelStorage& levelStorage
150 );
151
152 MCAPI void update(::Level& level, ::LevelStorage& levelStorage);
153
154 MCAPI ~TickingAreasManager();
155 // NOLINTEND
156
157public:
158 // static functions
159 // NOLINTBEGIN
160 MCAPI static ::TickingAreasManager::AreaLimitCheck getLimitCheck(::Level const& level, bool enforce);
161 // NOLINTEND
162
163public:
164 // constructor thunks
165 // NOLINTBEGIN
166 MCAPI void* $ctor(::Bedrock::NonOwnerPointer<::LevelStorage> levelStorage);
167 // NOLINTEND
168
169public:
170 // destructor thunk
171 // NOLINTBEGIN
172 MCAPI void $dtor();
173 // NOLINTEND
174};
Definition Actor.h:102
Definition AutomaticID.h:6
Definition NonOwnerPointer.h:9
Definition BlockPos.h:17
Definition CompoundTag.h:13
Definition Dimension.h:83
Definition IActorManagerConnector.h:14
Definition ILevelStorageManagerConnector.h:13
Definition LevelStorage.h:25
Definition Level.h:243
Definition TickingAreaList.h:15
Definition TickingAreasManager.h:29
Definition ActorUniqueID.h:5
Definition Bounds.h:8
Definition PendingArea.h:19
Definition TickingAreaDescription.h:9