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/deps/core/utility/pub_sub/Publisher.h"
15#include "mc/world/level/LevelListCacheObserver.h"
29class IEntitlementManager;
40class StoreCatalogRepository;
52namespace Realms {
struct Content; }
53namespace Realms {
struct RealmId; }
57namespace mce {
class UUID; }
62 public ::std::enable_shared_from_this<::ContentManager> {
66 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::ContentManager>> mSelf;
67 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IWorldTemplateManager>> mWorldTemplateManager;
68 ::ll::TypedStorage<8, 8, ::IPackManifestFactory&> mPackManifestFactory;
69 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::MutableContentItemCollection>>> mContent;
70 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::ContentSource>>> mContentSources;
71 ::ll::TypedStorage<8, 24, ::ContentManagerContextCollection> mContexts;
72 ::ll::TypedStorage<8, 8, uint64> mContentId;
73 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::IContentCatalogPackSource>> mCatalogResourcePackSource;
74 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::Realms::RealmsServicePackSource>>>
75 mRealmsServicePackSources;
76 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::CachedHostPackIdProvider>> mCachedHostPackIdProvider;
77 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ContentManagerProxy>> mProxy;
78 ::ll::TypedStorage<1, 1, bool> mInitialized;
79 ::ll::TypedStorage<8, 32, ::std::string const> WORLD_RESOURCE_PACK_FILENAME;
80 ::ll::TypedStorage<8, 32, ::std::string const> WORLD_BEHAVIOR_PACK_FILENAME;
81 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager>> mFilePathManager;
82 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mMutex;
83 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IContentManagerFactory>> mFactory;
84 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::ContentManagerUtils::SourcesAsyncReloader>>>
86 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager>> mEntitlementManager;
87 ::ll::TypedStorage<8, 48, ::Bedrock::PubSub::Publisher<void(), ::Bedrock::PubSub::ThreadModel::SingleThreaded, 0>>
88 mReloadViewsPublisher;
89 ::ll::TypedStorage<8, 48, ::Bedrock::PubSub::Publisher<void(), ::Bedrock::PubSub::ThreadModel::SingleThreaded, 0>>
90 mDeleteContentPublisher;
91 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::StorageManager::ContentItemProvider>> mWeakStorageContentItemProvider;
92 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::StorageManager::IContentHandler>>>
93 mStorageContentHandler;
94 ::ll::TypedStorage<8, 64, ::std::function<::std::shared_ptr<::StorageManager::WorldConverter>()>>
95 mStorageWorldConverterConstructor;
96 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::StorageManager::WorldConverter>> mWeakStorageWorldConverter;
101 ContentManager& operator=(ContentManager
const&);
102 ContentManager(ContentManager
const&);
108 virtual ~ContentManager() =
default;
110 virtual ::ContentSource* loadContent(::ContentType contentType, ::ContentFlags flags) ;
112 virtual ::ContentSource* loadContent(::InvalidPacksFilterGroup
const& invalidFilter) ;
114 virtual ::ContentSource*
115 loadContentForLevel(::std::string
const& levelId, ::mce::UUID
const& premiumTemplateId) ;
117 virtual ::ContentSource* loadContentForRealm(int64
const realmId) ;
119 virtual ::std::unique_ptr<::ContentSource> loadContentForRealmsWorld(
120 ::Realms::RealmId realmId,
121 ::std::vector<::Realms::Content>
const& servicePackData
124 virtual void addPackSourceFromPremiumTemplate(
125 ::RealmPackManagerContentSource* source,
126 ::mce::UUID
const& premiumTemplateId,
130 virtual void addRealmsUnknownPackSources(::RealmPackManagerContentSource* contentSource) ;
132 virtual void addPacksToRealmsUnknownPackSource(::std::unique_ptr<::Pack> pack) ;
134 virtual void addCachedHostPackIdProvider(::std::weak_ptr<::CachedHostPackIdProvider> provider) ;
136 virtual void clearRealmsUnknownPackSource() ;
138 virtual void removeUnneededItemFromRealmsUnknownContentSource(::mce::UUID
const&
id) ;
140 virtual ::gsl::not_null<::std::shared_ptr<::ContentItemCollection>>
141 getGlobalResourcePackCollection(
bool isEditorMode) ;
143 virtual ::std::unique_ptr<::IContentManagerContext>
144 createContext(::std::function<
bool(::std::shared_ptr<::ContentItem const>
const&)> contextPredicate) ;
146 virtual void removeContext(::IContentManagerContext& context) ;
148 virtual ::std::vector<::std::unique_ptr<::ContentSource>>
const& getSources() const ;
150 virtual ::std::vector<::std::shared_ptr<::ContentItem>> getContentItems() const ;
152 virtual ::std::shared_ptr<::IVersionedContentItemCollection const> getVersionedItems() const ;
154 virtual
void enableCatalogPackSource() ;
156 virtual
void generateItems(::ContentSource* source) ;
158 virtual ::Bedrock::Threading::Async<
void> refreshPackSources(
bool saveSources) ;
160 virtual ::Bedrock::Threading::Async<
void> reloadSources(
bool saveSources) ;
162 virtual
void reloadItems() ;
164 virtual
void reloadViews() ;
166 virtual
void populateDependencies() const ;
168 virtual
void deleteContent(::std::shared_ptr<::ContentItem const> const& contentItem) ;
170 virtual
void deleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) ;
172 virtual
void deleteContentFiles(::std::shared_ptr<::ContentItem const> const& contentItem) ;
175 deleteContentFiles(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) ;
177 virtual
void postDeleteContent(::std::shared_ptr<::ContentItem const> const& contentItem) ;
180 postDeleteContent(::std::vector<::std::shared_ptr<::ContentItem const>> const& contentItems) ;
182 virtual uint64 generateContentId() ;
184 virtual ::Core::PathBuffer<::std::
string> const getWorldResourcePath(::std::
string const& levelId) const
187 virtual ::Core::PathBuffer<::std::
string> const getWorldBehaviorPath(::std::
string const& levelId) const
190 virtual ::Core::PathBuffer<::std::
string> const getWorldResourceFolder(::std::
string const& levelId) const
193 virtual ::Core::PathBuffer<::std::
string> const getWorldBehaviorFolder(::std::
string const& levelId) const
196 virtual ::Core::PathBuffer<::std::
string> const getWorldPath(::std::
string const& levelId) const ;
198 virtual ::Core::PathBuffer<::std::
string> const&
199 getPremiumWorldTemplateFolder(::ContentIdentity const& templateId) ;
201 virtual ::ContentManagerProxy* getProxy() ;
203 virtual
void beginAsyncInit(::TaskGroup& taskGroup) ;
205 virtual
bool isInitialized() const ;
207 virtual
void onLanguageChanged() ;
209 virtual
void refreshContentCatalogPackSource() ;
211 virtual ::Bedrock::PubSub::Subscription
212 refreshContentCatalogPackSource(::std::function<
void()>&& callback) ;
214 virtual ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> getFilePathManager() ;
216 virtual
void onLevelDeleted(::std::
string const& levelId) ;
218 virtual
void onRealmsReset(::Realms::RealmId const realmsId) ;
220 virtual ::Bedrock::PubSub::Subscription
221 subscribeToSourcesReloadedAsyncCompleted(::std::function<
void()>&& onSourcesReloadedAsyncCallback) ;
223 virtual ::std::shared_ptr<::StorageManager::ContentItemProvider> getStorageContentItemProvider() ;
225 virtual ::StorageManager::IContentHandler& getStorageContentHandler() ;
227 virtual ::std::shared_ptr<::StorageManager::WorldConverter> getStorageWorldConverter() ;
229 virtual ::Bedrock::PubSub::Subscription registerToReloadViews(::std::function<
void()> callback) ;
231 virtual ::Bedrock::PubSub::Subscription registerToDeleteContent(::std::function<
void()> callback) ;
237 MCNAPI ContentManager(
243 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
245 ::Bedrock::NotNullNonOwnerPtr<::StoreCatalogRepository> const& storeCatalog,
248 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& filePathManager,
249 ::
std::unique_ptr<::StorageManager::IContentHandler> storageContentHandler,
250 ::
std::function<::
std::shared_ptr<::StorageManager::WorldConverter>()> storageWorldConverterConstructor
260 ::
std::vector<::gsl::not_null<::
std::shared_ptr<::
Pack>>>&& servicePackData
283 ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager> entitlementManager,
285 ::Bedrock::NotNullNonOwnerPtr<::StoreCatalogRepository> const& storeCatalog,
288 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& filePathManager,
289 ::
std::unique_ptr<::StorageManager::IContentHandler> storageContentHandler,
290 ::
std::function<::
std::shared_ptr<::StorageManager::WorldConverter>()> storageWorldConverterConstructor
310 ::mce::UUID const& premiumTemplateId,
396 MCNAPI ::Bedrock::PubSub::Subscription
Definition Subscription.h:10
Definition CachedHostPackIdProvider.h:5
Definition ClientPackSourceFactory.h:5
Definition ContentCatalogService.h:5
Definition ContentIdentity.h:8
Definition ContentItemCollection.h:5
Definition ContentManagerProxy.h:5
Definition SourcesAsyncReloader.h:7
Definition ContentManager.h:5
MCAPI ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager > $getFilePathManager()
MCAPI ::Core::PathBuffer<::std::string > const $getWorldBehaviorPath(::std::string const &levelId) const
MCAPI void $postDeleteContent(::std::shared_ptr<::ContentItem const > const &contentItem)
MCAPI ::Core::PathBuffer<::std::string > const $getWorldBehaviorFolder(::std::string const &levelId) const
MCAPI::Bedrock::PubSub::Subscription $subscribeToSourcesReloadedAsyncCompleted(::std::function< void()> &&onSourcesReloadedAsyncCallback)
MCAPI void $addPackSourceFromPremiumTemplate(::RealmPackManagerContentSource *source, ::mce::UUID const &premiumTemplateId, ::PackType packType)
MCAPI void $removeUnneededItemFromRealmsUnknownContentSource(::mce::UUID const &id)
MCAPI void $onLevelDeleted(::std::string const &levelId)
MCAPI::ContentSource * $loadContentForLevel(::std::string const &levelId, ::mce::UUID const &premiumTemplateId)
MCAPI ::Bedrock::Threading::Async< void > $reloadSources(bool saveSources)
MCAPI ::Core::PathBuffer<::std::string > const $getWorldResourceFolder(::std::string const &levelId) const
MCAPI void $addCachedHostPackIdProvider(::std::weak_ptr<::CachedHostPackIdProvider > provider)
MCAPI::StorageManager::IContentHandler & $getStorageContentHandler()
MCAPI bool $isInitialized() const
MCAPI void _removeContentItemsFromSource(::gsl::not_null<::ContentSource * > source)
MCAPI void $clearRealmsUnknownPackSource()
MCAPI ::std::vector<::std::unique_ptr<::ContentSource > > const & $getSources() const
MCAPI ::Core::PathBuffer<::std::string > const $getWorldResourcePath(::std::string const &levelId) const
MCAPI void $enableCatalogPackSource()
MCAPI::ContentSource * $loadContent(::ContentType contentType, ::ContentFlags flags)
MCAPI::ContentManagerProxy * $getProxy()
MCAPI ::std::shared_ptr<::IVersionedContentItemCollection const > $getVersionedItems() const
MCAPI ::Bedrock::Threading::Async< void > $refreshPackSources(bool saveSources)
MCAPI::ContentSource * $loadContentForRealm(int64 const realmId)
MCAPI void $deleteContent(::std::shared_ptr<::ContentItem const > const &contentItem)
MCAPI void $reloadViews()
MCAPI ::Core::PathBuffer<::std::string > const & $getPremiumWorldTemplateFolder(::ContentIdentity const &templateId)
MCAPI void _retrievePackSources(::PackType packType, ::std::vector<::PackSource * > &packSources)
MCAPI ::std::vector<::std::shared_ptr<::ContentItem > > $getContentItems() const
MCAPI uint64 $generateContentId()
MCAPI void $beginAsyncInit(::TaskGroup &taskGroup)
MCAPI void $deleteContentFiles(::std::shared_ptr<::ContentItem const > const &contentItem)
MCAPI void $addRealmsUnknownPackSources(::RealmPackManagerContentSource *contentSource)
MCAPI void $removeContext(::IContentManagerContext &context)
MCAPI ::Core::PathBuffer<::std::string > const $getWorldPath(::std::string const &levelId) const
MCAPI ::gsl::not_null<::std::shared_ptr<::ContentItemCollection > > $getGlobalResourcePackCollection(bool isEditorMode)
MCAPI void $onRealmsReset(::Realms::RealmId const realmsId)
MCAPI ::std::unique_ptr<::ContentSource > $loadContentForRealmsWorld(::Realms::RealmId realmId, ::std::vector<::Realms::Content > const &servicePackData)
MCAPI void $generateItems(::ContentSource *source)
MCAPI ::Bedrock::NotNullNonOwnerPtr<::Realms::RealmsServicePackSource > _updateOrCreateRealmsServicePackSource(int64 realmId, ::PackType packType, ::std::vector<::gsl::not_null<::std::shared_ptr<::Pack > > > &&servicePackData)
MCAPI void $reloadItems()
MCAPI::Bedrock::PubSub::Subscription $registerToReloadViews(::std::function< void()> callback)
MCAPI::Bedrock::PubSub::Subscription $registerToDeleteContent(::std::function< void()> callback)
MCAPI ::std::shared_ptr<::StorageManager::WorldConverter > $getStorageWorldConverter()
MCAPI ::std::shared_ptr<::StorageManager::ContentItemProvider > $getStorageContentItemProvider()
MCAPI void $addPacksToRealmsUnknownPackSource(::std::unique_ptr<::Pack > pack)
static MCAPI void _deleteContent(::std::vector<::std::shared_ptr<::ContentItem const > > const &contentItems, ::std::function< void(::ContentSource &, ::std::vector<::std::shared_ptr<::ContentItem const > > const &)> deleteItemCallback)
MCAPI void * $ctor(::ILevelListCache &levelListCache, ::Bedrock::NotNullNonOwnerPtr<::WorldTemplateManager > const &worldTemplateManager, ::IResourcePackRepository &resourcePackRepository, ::ResourcePackManager &resourcePackManager, ::PackManifestFactory &packManifestFactory, ::Bedrock::NotNullNonOwnerPtr<::IEntitlementManager > entitlementManager, ::Bedrock::NotNullNonOwnerPtr<::IContentTierManager const > const &contentTierManager, ::Bedrock::NotNullNonOwnerPtr<::StoreCatalogRepository > const &storeCatalog, ::Bedrock::NotNullNonOwnerPtr<::ContentCatalogService > const &contentCatalogService, ::ClientPackSourceFactory &packSourceFactory, ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager > const &filePathManager, ::std::unique_ptr<::StorageManager::IContentHandler > storageContentHandler, ::std::function<::std::shared_ptr<::StorageManager::WorldConverter >()> storageWorldConverterConstructor)
MCAPI void $onLanguageChanged()
MCAPI void $populateDependencies() const
MCAPI ::std::unique_ptr<::IContentManagerContext > $createContext(::std::function< bool(::std::shared_ptr<::ContentItem const > const &)> contextPredicate)
MCAPI void $refreshContentCatalogPackSource()
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:36
Definition IVersionedContentItemCollection.h:5
Definition IWorldTemplateManager.h:17
Definition LevelListCacheObserver.h:13
Definition MutableContentItemCollection.h:5
Definition PackManifestFactory.h:21
Definition PackSource.h:28
Definition RealmsServicePackSource.h:18
Definition ResourcePackManager.h:29
Definition ContentItemProvider.h:7
Definition IContentHandler.h:7
Definition WorldConverter.h:7
Definition TaskGroup.h:85
Definition WorldTemplateManager.h:20
Definition SingleThreaded.h:7
Definition ContentItem.h:5
Definition ContentSource.h:5
Definition InvalidPacksFilterGroup.h:5
Definition RealmPackManagerContentSource.h:5