3#include "mc/_HeaderOutputPredefine.h"
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"
42struct IEntitlementManager;
45struct StoreCatalogRepository;
50namespace Realms {
struct Content; }
51namespace Realms {
struct RealmId; }
52namespace mce {
class UUID; }
57 public ::std::enable_shared_from_this<::ContentManager> {
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>>>
85 ContentManager& operator=(ContentManager
const&);
86 ContentManager(ContentManager
const&);
92 virtual ~ContentManager() ;
94 virtual ::ContentSource* loadContent(::ContentType contentType, ::ContentFlags flags) ;
96 virtual ::ContentSource* loadContent(::InvalidPacksFilterGroup
const& invalidFilter) ;
98 virtual ::ContentSource*
99 loadContentForLevel(::std::string
const& levelId, ::mce::UUID
const& premiumTemplateId) ;
101 virtual ::ContentSource* loadContentForRealm(int64
const realmId) ;
103 virtual ::std::unique_ptr<::ContentSource> loadContentForRealmsWorld(
104 ::Realms::RealmId realmId,
105 ::std::vector<::Realms::Content>
const& servicePackData
108 virtual void addPackSourceFromPremiumTemplate(
109 ::RealmPackManagerContentSource* source,
110 ::mce::UUID
const& premiumTemplateId,
114 virtual void addRealmsUnknownPackSources(::RealmPackManagerContentSource* contentSource) ;
116 virtual void addPacksToRealmsUnknownPackSource(::std::unique_ptr<::Pack> pack) ;
118 virtual void addCachedHostPackIdProvider(::std::weak_ptr<::CachedHostPackIdProvider> provider) ;
120 virtual void clearRealmsUnknownPackSource() ;
122 virtual void removeUnneededItemFromRealmsUnknownContentSource(::mce::UUID
const&
id) ;
124 virtual ::gsl::not_null<::std::shared_ptr<::ContentItemCollection>>
125 getGlobalResourcePackCollection(
bool isEditorMode) ;
127 virtual ::std::unique_ptr<::IContentManagerContext>
128 createContext(::std::function<
bool(::std::shared_ptr<::ContentItem const>
const&)> contextPredicate) ;
130 virtual void removeContext(::IContentManagerContext& context) ;
132 virtual ::std::vector<::std::unique_ptr<::ContentSource>>
const& getSources() const ;
134 virtual ::std::vector<::std::shared_ptr<::ContentItem>> getContentItems() const ;
136 virtual ::std::shared_ptr<::IVersionedContentItemCollection const> getVersionedItems() const ;
138 virtual
void enableCatalogPackSource() ;
140 virtual
void generateItems(::ContentSource* source) ;
142 virtual ::Bedrock::Threading::Async<
void> reloadSources(
bool saveSources) ;
144 virtual
void reloadItems() ;
146 virtual
void reloadViews() ;
148 virtual
void populateDependencies() const ;
150 virtual
void deleteContent(::std::shared_ptr<::ContentItem const> const& contentItem) ;
152 virtual
void deleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) ;
154 virtual
void deleteContentFiles(::std::shared_ptr<::ContentItem const> const& contentItem) ;
157 deleteContentFiles(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) ;
159 virtual
void postDeleteContent(::std::shared_ptr<::ContentItem const> const& contentItem) ;
162 postDeleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) ;
164 virtual uint64 generateContentId() ;
166 virtual ::Core::PathBuffer<::std::
string> const getWorldResourcePath(::std::
string const& levelId) const
169 virtual ::Core::PathBuffer<::std::
string> const getWorldBehaviorPath(::std::
string const& levelId) const
172 virtual ::Core::PathBuffer<::std::
string> const getWorldResourceFolder(::std::
string const& levelId) const
175 virtual ::Core::PathBuffer<::std::
string> const getWorldBehaviorFolder(::std::
string const& levelId) const
178 virtual ::Core::PathBuffer<::std::
string> const getWorldPath(::std::
string const& levelId) const ;
180 virtual ::Core::PathBuffer<::std::
string> const&
181 getPremiumWorldTemplateFolder(::ContentIdentity const& templateId) ;
183 virtual ::ContentManagerProxy* getProxy() ;
185 virtual
void beginAsyncInit(::TaskGroup& taskGroup) ;
187 virtual
bool isInitialized() const ;
189 virtual
void onLanguageChanged() ;
191 virtual
void refreshContentCatalogPackSource() ;
193 virtual ::Bedrock::PubSub::Subscription
194 refreshContentCatalogPackSource(::std::function<
void()>&& callback) ;
196 virtual ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> getFilePathManager() ;
198 virtual
void onLevelDeleted(::std::
string const& levelId) ;
200 virtual
void onRealmsReset(::Realms::RealmId const realmsId) ;
202 virtual ::Bedrock::PubSub::Subscription
203 subscribeToSourcesReloadedAsyncCompleted(::std::function<
void()>&& onSourcesReloadedAsyncCallback) ;
209 MCAPI ContentManager(
210 ::std::unique_ptr<::IContentManagerFactory> factory,
211 ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager> worldTemplateManager,
212 ::IPackManifestFactory& packManifestFactory,
213 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> filePathManager
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
230 MCAPI ::ContentSource* _addContentSource(::std::unique_ptr<::ContentSource> source);
232 MCAPI
void _asyncInitWork();
234 MCAPI ::IContentCatalogPackSource& _createContentCatalogPackSource(
bool enabled);
236 MCAPI
void _initCallback();
238 MCAPI ::ContentSource* _loadResourceContent(::ContentType type, ::ContentFlags flags);
240 MCAPI
void _removeContentItemsFromSource(::gsl::not_null<::ContentSource*> source);
242 MCAPI
void _retrievePackSources(::PackType packType, ::std::vector<::PackSource*>& packSources);
244 MCAPI ::Bedrock::NotNullNonOwnerPtr<::Realms::RealmsServicePackSource> _updateOrCreateRealmsServicePackSource(
247 ::std::vector<::gsl::not_null<::std::shared_ptr<::Pack>>>&& servicePackData
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&)>
260 MCAPI static ::std::vector<::std::shared_ptr<::ContentItem const>>
261 _prepareContentItemsForDeleting(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
268 ::std::unique_ptr<::IContentManagerFactory> factory,
269 ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager> worldTemplateManager,
270 ::IPackManifestFactory& packManifestFactory,
271 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> filePathManager
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
298 MCAPI ::ContentSource* $loadContent(::ContentType contentType, ::ContentFlags flags);
300 MCAPI ::ContentSource* $loadContent(::InvalidPacksFilterGroup const& invalidFilter);
302 MCAPI ::ContentSource* $loadContentForLevel(::std::
string const& levelId, ::mce::UUID const& premiumTemplateId);
304 MCAPI ::ContentSource* $loadContentForRealm(int64 const realmId);
306 MCAPI ::std::unique_ptr<::ContentSource>
307 $loadContentForRealmsWorld(::Realms::RealmId realmId, ::std::vector<::Realms::Content> const& servicePackData);
309 MCAPI
void $addPackSourceFromPremiumTemplate(
310 ::RealmPackManagerContentSource* source,
311 ::mce::UUID const& premiumTemplateId,
315 MCAPI
void $addRealmsUnknownPackSources(::RealmPackManagerContentSource* contentSource);
317 MCAPI
void $addPacksToRealmsUnknownPackSource(::std::unique_ptr<::Pack> pack);
319 MCAPI
void $addCachedHostPackIdProvider(::std::weak_ptr<::CachedHostPackIdProvider> provider);
321 MCAPI
void $clearRealmsUnknownPackSource();
323 MCAPI
void $removeUnneededItemFromRealmsUnknownContentSource(::mce::UUID const&
id);
325 MCAPI ::gsl::not_null<::std::shared_ptr<::ContentItemCollection>>
326 $getGlobalResourcePackCollection(
bool isEditorMode);
328 MCAPI ::std::unique_ptr<::IContentManagerContext>
329 $createContext(::std::function<
bool(::std::shared_ptr<::ContentItem const> const&)> contextPredicate);
331 MCAPI
void $removeContext(::IContentManagerContext& context);
333 MCFOLD ::std::vector<::std::unique_ptr<::ContentSource>> const& $getSources() const;
335 MCAPI ::std::vector<::std::shared_ptr<::ContentItem>> $getContentItems() const;
337 MCFOLD ::std::shared_ptr<::IVersionedContentItemCollection const> $getVersionedItems() const;
339 MCAPI
void $enableCatalogPackSource();
341 MCAPI
void $generateItems(::ContentSource* source);
343 MCAPI ::Bedrock::Threading::Async<
void> $reloadSources(
bool saveSources);
345 MCAPI
void $reloadItems();
347 MCAPI
void $reloadViews();
349 MCAPI
void $populateDependencies() const;
351 MCAPI
void $deleteContent(::std::shared_ptr<::ContentItem const> const& contentItem);
353 MCAPI
void $deleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
355 MCAPI
void $deleteContentFiles(::std::shared_ptr<::ContentItem const> const& contentItem);
357 MCAPI
void $deleteContentFiles(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
359 MCAPI
void $postDeleteContent(::std::shared_ptr<::ContentItem const> const& contentItem);
361 MCAPI
void $postDeleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems);
363 MCAPI uint64 $generateContentId();
365 MCAPI ::Core::PathBuffer<::std::
string> const $getWorldResourcePath(::std::
string const& levelId) const;
367 MCAPI ::Core::PathBuffer<::std::
string> const $getWorldBehaviorPath(::std::
string const& levelId) const;
369 MCAPI ::Core::PathBuffer<::std::
string> const $getWorldResourceFolder(::std::
string const& levelId) const;
371 MCAPI ::Core::PathBuffer<::std::
string> const $getWorldBehaviorFolder(::std::
string const& levelId) const;
373 MCAPI ::Core::PathBuffer<::std::
string> const $getWorldPath(::std::
string const& levelId) const;
375 MCAPI ::Core::PathBuffer<::std::
string> const& $getPremiumWorldTemplateFolder(::ContentIdentity const& templateId);
377 MCAPI ::ContentManagerProxy* $getProxy();
379 MCAPI
void $beginAsyncInit(::TaskGroup& taskGroup);
381 MCFOLD
bool $isInitialized() const;
383 MCAPI
void $onLanguageChanged();
385 MCAPI
void $refreshContentCatalogPackSource();
387 MCAPI ::Bedrock::PubSub::Subscription $refreshContentCatalogPackSource(::std::function<
void()>&& callback);
389 MCAPI ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> $getFilePathManager();
391 MCAPI
void $onLevelDeleted(::std::
string const& levelId);
393 MCAPI
void $onRealmsReset(::Realms::RealmId const realmsId);
395 MCAPI ::Bedrock::PubSub::Subscription
396 $subscribeToSourcesReloadedAsyncCompleted(::std::function<
void()>&& onSourcesReloadedAsyncCallback);
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 RealmsServicePackSource.h:18
Definition ResourcePackManager.h:29
Definition TaskGroup.h:53
Definition WorldTemplateManager.h:21
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