LeviLamina
Loading...
Searching...
No Matches
ContentManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/gui/screens/models/ContentFlags.h"
7#include "mc/client/gui/screens/models/ContentManagerContextCollection.h"
8#include "mc/client/gui/screens/models/ContentType.h"
9#include "mc/client/gui/screens/models/IContentManager.h"
10#include "mc/deps/core/file/PathBuffer.h"
11#include "mc/deps/core/resource/PackType.h"
12#include "mc/deps/core/threading/Async.h"
13#include "mc/deps/core/utility/NonOwnerPointer.h"
14#include "mc/world/level/LevelListCacheObserver.h"
15
16// auto generated forward declare list
17// clang-format off
18class ContentIdentity;
25class ILevelListCache;
31class Pack;
33class PackSource;
35class TaskGroup;
40struct ContentItem;
41struct ContentSource;
42struct IEntitlementManager;
45struct StoreCatalogRepository;
46namespace Bedrock::PubSub { class Subscription; }
47namespace ContentManagerUtils { class SourcesAsyncReloader; }
48namespace Core { class FilePathManager; }
49namespace Realms { class RealmsServicePackSource; }
50namespace Realms { struct Content; }
51namespace Realms { struct RealmId; }
52namespace mce { class UUID; }
53// clang-format on
54
57 public ::std::enable_shared_from_this<::ContentManager> {
58public:
59 // member variables
60 // NOLINTBEGIN
61 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::ContentManager>> mSelf;
62 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager>> mWorldTemplateManager;
63 ::ll::TypedStorage<8, 8, ::IPackManifestFactory&> mPackManifestFactory;
64 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::MutableContentItemCollection>>> mContent;
65 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::ContentSource>>> mContentSources;
66 ::ll::TypedStorage<8, 24, ::ContentManagerContextCollection> mContexts;
67 ::ll::TypedStorage<8, 8, uint64> mContentId;
68 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::IContentCatalogPackSource>> mCatalogResourcePackSource;
69 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::Realms::RealmsServicePackSource>>>
70 mRealmsServicePackSources;
71 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::CachedHostPackIdProvider>> mCachedHostPackIdProvider;
72 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ContentManagerProxy>> mProxy;
73 ::ll::TypedStorage<1, 1, bool> mInitialized;
74 ::ll::TypedStorage<8, 32, ::std::string const> WORLD_RESOURCE_PACK_FILENAME;
75 ::ll::TypedStorage<8, 32, ::std::string const> WORLD_BEHAVIOR_PACK_FILENAME;
76 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager>> mFilePathManager;
77 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mMutex;
78 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IContentManagerFactory>> mFactory;
79 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::ContentManagerUtils::SourcesAsyncReloader>>>
80 mReloadSourcesAsync;
81 // NOLINTEND
82
83public:
84 // prevent constructor by default
85 ContentManager& operator=(ContentManager const&);
86 ContentManager(ContentManager const&);
87 ContentManager();
88
89public:
90 // virtual functions
91 // NOLINTBEGIN
92 virtual ~ContentManager() /*override*/;
93
94 virtual ::ContentSource* loadContent(::ContentType contentType, ::ContentFlags flags) /*override*/;
95
96 virtual ::ContentSource* loadContent(::InvalidPacksFilterGroup const& invalidFilter) /*override*/;
97
98 virtual ::ContentSource*
99 loadContentForLevel(::std::string const& levelId, ::mce::UUID const& premiumTemplateId) /*override*/;
100
101 virtual ::ContentSource* loadContentForRealm(int64 const realmId) /*override*/;
102
103 virtual ::std::unique_ptr<::ContentSource> loadContentForRealmsWorld(
104 ::Realms::RealmId realmId,
105 ::std::vector<::Realms::Content> const& servicePackData
106 ) /*override*/;
107
108 virtual void addPackSourceFromPremiumTemplate(
109 ::RealmPackManagerContentSource* source,
110 ::mce::UUID const& premiumTemplateId,
111 ::PackType packType
112 ) /*override*/;
113
114 virtual void addRealmsUnknownPackSources(::RealmPackManagerContentSource* contentSource) /*override*/;
115
116 virtual void addPacksToRealmsUnknownPackSource(::std::unique_ptr<::Pack> pack) /*override*/;
117
118 virtual void addCachedHostPackIdProvider(::std::weak_ptr<::CachedHostPackIdProvider> provider) /*override*/;
119
120 virtual void clearRealmsUnknownPackSource() /*override*/;
121
122 virtual void removeUnneededItemFromRealmsUnknownContentSource(::mce::UUID const& id) /*override*/;
123
124 virtual ::gsl::not_null<::std::shared_ptr<::ContentItemCollection>>
125 getGlobalResourcePackCollection(bool isEditorMode) /*override*/;
126
127 virtual ::std::unique_ptr<::IContentManagerContext>
128 createContext(::std::function<bool(::std::shared_ptr<::ContentItem const> const&)> contextPredicate) /*override*/;
129
130 virtual void removeContext(::IContentManagerContext& context) /*override*/;
131
132 virtual ::std::vector<::std::unique_ptr<::ContentSource>> const& getSources() const /*override*/;
133
134 virtual ::std::vector<::std::shared_ptr<::ContentItem>> getContentItems() const /*override*/;
135
136 virtual ::std::shared_ptr<::IVersionedContentItemCollection const> getVersionedItems() const /*override*/;
137
138 virtual void enableCatalogPackSource() /*override*/;
139
140 virtual void generateItems(::ContentSource* source) /*override*/;
141
142 virtual ::Bedrock::Threading::Async<void> reloadSources(bool saveSources) /*override*/;
143
144 virtual void reloadItems() /*override*/;
145
146 virtual void reloadViews() /*override*/;
147
148 virtual void populateDependencies() const /*override*/;
149
150 virtual void deleteContent(::std::shared_ptr<::ContentItem const> const& contentItem) /*override*/;
151
152 virtual void deleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) /*override*/;
153
154 virtual void deleteContentFiles(::std::shared_ptr<::ContentItem const> const& contentItem) /*override*/;
155
156 virtual void
157 deleteContentFiles(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) /*override*/;
158
159 virtual void postDeleteContent(::std::shared_ptr<::ContentItem const> const& contentItem) /*override*/;
160
161 virtual void
162 postDeleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) /*override*/;
163
164 virtual uint64 generateContentId() /*override*/;
165
166 virtual ::Core::PathBuffer<::std::string> const getWorldResourcePath(::std::string const& levelId) const
167 /*override*/;
168
169 virtual ::Core::PathBuffer<::std::string> const getWorldBehaviorPath(::std::string const& levelId) const
170 /*override*/;
171
172 virtual ::Core::PathBuffer<::std::string> const getWorldResourceFolder(::std::string const& levelId) const
173 /*override*/;
174
175 virtual ::Core::PathBuffer<::std::string> const getWorldBehaviorFolder(::std::string const& levelId) const
176 /*override*/;
177
178 virtual ::Core::PathBuffer<::std::string> const getWorldPath(::std::string const& levelId) const /*override*/;
179
180 virtual ::Core::PathBuffer<::std::string> const&
181 getPremiumWorldTemplateFolder(::ContentIdentity const& templateId) /*override*/;
182
183 virtual ::ContentManagerProxy* getProxy() /*override*/;
184
185 virtual void beginAsyncInit(::TaskGroup& taskGroup) /*override*/;
186
187 virtual bool isInitialized() const /*override*/;
188
189 virtual void onLanguageChanged() /*override*/;
190
191 virtual void refreshContentCatalogPackSource() /*override*/;
192
193 virtual ::Bedrock::PubSub::Subscription
194 refreshContentCatalogPackSource(::std::function<void()>&& callback) /*override*/;
195
196 virtual ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> getFilePathManager() /*override*/;
197
198 virtual void onLevelDeleted(::std::string const& levelId) /*override*/;
199
200 virtual void onRealmsReset(::Realms::RealmId const realmsId) /*override*/;
201
202 virtual ::Bedrock::PubSub::Subscription
203 subscribeToSourcesReloadedAsyncCompleted(::std::function<void()>&& onSourcesReloadedAsyncCallback) /*override*/;
204 // NOLINTEND
205
206public:
207 // member functions
208 // NOLINTBEGIN
209 MCAPI ContentManager(
210 ::std::unique_ptr<::IContentManagerFactory> factory,
211 ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager> worldTemplateManager,
212 ::IPackManifestFactory& packManifestFactory,
213 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> filePathManager
214 );
215
216 MCAPI ContentManager(
217 ::ILevelListCache& levelListCache,
218 ::Bedrock::NotNullNonOwnerPtr<::WorldTemplateManager> const& worldTemplateManager,
219 ::IResourcePackRepository& resourcePackRepository,
220 ::ResourcePackManager& resourcePackManager,
221 ::PackManifestFactory& packManifestFactory,
222 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
223 ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const> const& contentTierManager,
224 ::Bedrock::NotNullNonOwnerPtr<::StoreCatalogRepository> const& storeCatalog,
225 ::Bedrock::NotNullNonOwnerPtr<::ContentCatalogService> const& contentCatalogService,
226 ::ClientPackSourceFactory& packSourceFactory,
227 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& filePathManager
228 );
229
230 MCAPI ::ContentSource* _addContentSource(::std::unique_ptr<::ContentSource> source);
231
232 MCAPI void _asyncInitWork();
233
234 MCAPI ::IContentCatalogPackSource& _createContentCatalogPackSource(bool enabled);
235
236 MCAPI void _initCallback();
237
238 MCAPI ::ContentSource* _loadResourceContent(::ContentType type, ::ContentFlags flags);
239
240 MCAPI void _removeContentItemsFromSource(::gsl::not_null<::ContentSource*> source);
241
242 MCAPI void _retrievePackSources(::PackType packType, ::std::vector<::PackSource*>& packSources);
243
244 MCAPI ::Bedrock::NotNullNonOwnerPtr<::Realms::RealmsServicePackSource> _updateOrCreateRealmsServicePackSource(
245 int64 realmId,
246 ::PackType packType,
247 ::std::vector<::gsl::not_null<::std::shared_ptr<::Pack>>>&& servicePackData
248 );
249 // NOLINTEND
250
251public:
252 // static functions
253 // NOLINTBEGIN
254 MCAPI static void _deleteContent(
255 ::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems,
256 ::std::function<void(::ContentSource&, ::std::vector<::std::shared_ptr<::ContentItem const>> const&)>
257 deleteItemCallback
258 );
259
260 MCAPI static ::std::vector<::std::shared_ptr<::ContentItem const>>
261 _prepareContentItemsForDeleting(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
262 // NOLINTEND
263
264public:
265 // constructor thunks
266 // NOLINTBEGIN
267 MCAPI void* $ctor(
268 ::std::unique_ptr<::IContentManagerFactory> factory,
269 ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager> worldTemplateManager,
270 ::IPackManifestFactory& packManifestFactory,
271 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> filePathManager
272 );
273
274 MCAPI void* $ctor(
275 ::ILevelListCache& levelListCache,
276 ::Bedrock::NotNullNonOwnerPtr<::WorldTemplateManager> const& worldTemplateManager,
277 ::IResourcePackRepository& resourcePackRepository,
278 ::ResourcePackManager& resourcePackManager,
279 ::PackManifestFactory& packManifestFactory,
280 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
281 ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const> const& contentTierManager,
282 ::Bedrock::NotNullNonOwnerPtr<::StoreCatalogRepository> const& storeCatalog,
283 ::Bedrock::NotNullNonOwnerPtr<::ContentCatalogService> const& contentCatalogService,
284 ::ClientPackSourceFactory& packSourceFactory,
285 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& filePathManager
286 );
287 // NOLINTEND
288
289public:
290 // destructor thunk
291 // NOLINTBEGIN
292 MCAPI void $dtor();
293 // NOLINTEND
294
295public:
296 // virtual function thunks
297 // NOLINTBEGIN
298 MCAPI ::ContentSource* $loadContent(::ContentType contentType, ::ContentFlags flags);
299
300 MCAPI ::ContentSource* $loadContent(::InvalidPacksFilterGroup const& invalidFilter);
301
302 MCAPI ::ContentSource* $loadContentForLevel(::std::string const& levelId, ::mce::UUID const& premiumTemplateId);
303
304 MCAPI ::ContentSource* $loadContentForRealm(int64 const realmId);
305
306 MCAPI ::std::unique_ptr<::ContentSource>
307 $loadContentForRealmsWorld(::Realms::RealmId realmId, ::std::vector<::Realms::Content> const& servicePackData);
308
309 MCAPI void $addPackSourceFromPremiumTemplate(
310 ::RealmPackManagerContentSource* source,
311 ::mce::UUID const& premiumTemplateId,
312 ::PackType packType
313 );
314
315 MCAPI void $addRealmsUnknownPackSources(::RealmPackManagerContentSource* contentSource);
316
317 MCAPI void $addPacksToRealmsUnknownPackSource(::std::unique_ptr<::Pack> pack);
318
319 MCAPI void $addCachedHostPackIdProvider(::std::weak_ptr<::CachedHostPackIdProvider> provider);
320
321 MCAPI void $clearRealmsUnknownPackSource();
322
323 MCAPI void $removeUnneededItemFromRealmsUnknownContentSource(::mce::UUID const& id);
324
325 MCAPI ::gsl::not_null<::std::shared_ptr<::ContentItemCollection>>
326 $getGlobalResourcePackCollection(bool isEditorMode);
327
328 MCAPI ::std::unique_ptr<::IContentManagerContext>
329 $createContext(::std::function<bool(::std::shared_ptr<::ContentItem const> const&)> contextPredicate);
330
331 MCAPI void $removeContext(::IContentManagerContext& context);
332
333 MCFOLD ::std::vector<::std::unique_ptr<::ContentSource>> const& $getSources() const;
334
335 MCAPI ::std::vector<::std::shared_ptr<::ContentItem>> $getContentItems() const;
336
337 MCFOLD ::std::shared_ptr<::IVersionedContentItemCollection const> $getVersionedItems() const;
338
339 MCAPI void $enableCatalogPackSource();
340
341 MCAPI void $generateItems(::ContentSource* source);
342
343 MCAPI ::Bedrock::Threading::Async<void> $reloadSources(bool saveSources);
344
345 MCAPI void $reloadItems();
346
347 MCAPI void $reloadViews();
348
349 MCAPI void $populateDependencies() const;
350
351 MCAPI void $deleteContent(::std::shared_ptr<::ContentItem const> const& contentItem);
352
353 MCAPI void $deleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
354
355 MCAPI void $deleteContentFiles(::std::shared_ptr<::ContentItem const> const& contentItem);
356
357 MCAPI void $deleteContentFiles(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
358
359 MCAPI void $postDeleteContent(::std::shared_ptr<::ContentItem const> const& contentItem);
360
361 MCAPI void $postDeleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
362
363 MCAPI uint64 $generateContentId();
364
365 MCAPI ::Core::PathBuffer<::std::string> const $getWorldResourcePath(::std::string const& levelId) const;
366
367 MCAPI ::Core::PathBuffer<::std::string> const $getWorldBehaviorPath(::std::string const& levelId) const;
368
369 MCAPI ::Core::PathBuffer<::std::string> const $getWorldResourceFolder(::std::string const& levelId) const;
370
371 MCAPI ::Core::PathBuffer<::std::string> const $getWorldBehaviorFolder(::std::string const& levelId) const;
372
373 MCAPI ::Core::PathBuffer<::std::string> const $getWorldPath(::std::string const& levelId) const;
374
375 MCAPI ::Core::PathBuffer<::std::string> const& $getPremiumWorldTemplateFolder(::ContentIdentity const& templateId);
376
377 MCAPI ::ContentManagerProxy* $getProxy();
378
379 MCAPI void $beginAsyncInit(::TaskGroup& taskGroup);
380
381 MCFOLD bool $isInitialized() const;
382
383 MCAPI void $onLanguageChanged();
384
385 MCAPI void $refreshContentCatalogPackSource();
386
387 MCAPI ::Bedrock::PubSub::Subscription $refreshContentCatalogPackSource(::std::function<void()>&& callback);
388
389 MCAPI ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> $getFilePathManager();
390
391 MCAPI void $onLevelDeleted(::std::string const& levelId);
392
393 MCAPI void $onRealmsReset(::Realms::RealmId const realmsId);
394
395 MCAPI ::Bedrock::PubSub::Subscription
396 $subscribeToSourcesReloadedAsyncCompleted(::std::function<void()>&& onSourcesReloadedAsyncCallback);
397 // NOLINTEND
398
399public:
400 // vftables
401 // NOLINTBEGIN
402 MCNAPI static void** $vftableForIContentManager();
403
404 MCNAPI static void** $vftableForLevelListCacheObserver();
405 // NOLINTEND
406};
Definition Subscription.h:10
Definition ContentIdentity.h:8
Definition ContentItemCollection.h:5
Definition ContentManagerProxy.h:5
Definition SourcesAsyncReloader.h:7
Definition ContentManager.h:5
static MCAPI void ** $vftableForIContentManager()
static MCAPI void ** $vftableForLevelListCacheObserver()
Definition FilePathManager.h:18
Definition IContentCatalogPackSource.h:5
Definition IContentManagerContext.h:5
Definition IContentManagerFactory.h:5
Definition IContentManager.h:5
Definition IContentTierManager.h:13
Definition ILevelListCache.h:27
Definition IPackManifestFactory.h:17
Definition IResourcePackRepository.h:34
Definition IVersionedContentItemCollection.h:5
Definition IWorldTemplateManager.h:17
Definition LevelListCacheObserver.h:13
Definition MutableContentItemCollection.h:5
Definition PackManifestFactory.h:20
Definition PackSource.h:28
Definition Pack.h:27
Definition RealmsServicePackSource.h:18
Definition ResourcePackManager.h:29
Definition TaskGroup.h:53
Definition WorldTemplateManager.h:21
Definition UUID.h:7
Definition CachedHostPackIdProvider.h:5
Definition ClientPackSourceFactory.h:5
Definition ContentCatalogService.h:5
Definition ContentItem.h:5
Definition ContentSource.h:5
Definition InvalidPacksFilterGroup.h:5
Definition RealmPackManagerContentSource.h:5
Definition Content.h:7
Definition RealmId.h:7