LeviLamina
Loading...
Searching...
No Matches
ResourcePackRepository.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/gui/screens/controllers/PackCategory.h"
7#include "mc/deps/core/file/PathBuffer.h"
8#include "mc/deps/core/resource/ContentIdentity.h"
9#include "mc/deps/core/resource/PackOrigin.h"
10#include "mc/deps/core/resource/PackType.h"
11#include "mc/deps/core/threading/Async.h"
12#include "mc/deps/core/utility/NonOwnerPointer.h"
13#include "mc/platform/brstd/function_ref.h"
14#include "mc/resources/IContentSourceRepository.h"
15#include "mc/resources/IResourcePackRepository.h"
16#include "mc/resources/repository_loading/IRepositoryLoader.h"
17
18// auto generated forward declare list
19// clang-format off
23class InvalidPacks;
24class PackInstance;
29class RepositoryPacks;
32class ResourcePack;
35class TaskGroup;
37struct PackIdVersion;
38struct PackInstanceId;
39namespace Core { class FilePathManager; }
40namespace Core { class Path; }
41namespace PackCommand { class IPackCommandPipeline; }
42namespace RepositoryLoading { struct AllRefreshTaskData; }
43namespace RepositoryLoading { struct BuildTaskDataOptions; }
44namespace RepositoryLoading { struct VanillaPacks; }
45namespace mce { class UUID; }
46// clang-format on
47
48class ResourcePackRepository : public ::IResourcePackRepository, public ::IContentSourceRepository {
49public:
50 // ResourcePackRepository inner types declare
51 // clang-format off
53 // clang-format on
54
55 // ResourcePackRepository inner types define
56 class RepositoryLoaderImpl : public ::RepositoryLoading::IRepositoryLoader {
57 public:
58 // member variables
59 // NOLINTBEGIN
60 ::ll::TypedStorage<8, 8, ::ResourcePackRepository&> mRepository;
61 // NOLINTEND
62
63 public:
64 // prevent constructor by default
65 RepositoryLoaderImpl& operator=(RepositoryLoaderImpl const&);
66 RepositoryLoaderImpl(RepositoryLoaderImpl const&);
67 RepositoryLoaderImpl();
68
69 public:
70 // virtual functions
71 // NOLINTBEGIN
72 virtual ::std::shared_ptr<::RepositoryLoading::AllRefreshTaskData>
73 buildTaskData(::RepositoryLoading::BuildTaskDataOptions const& ops) /*override*/;
74
75 virtual void applyTaskResults(::RepositoryLoading::AllRefreshTaskData&& taskData) /*override*/;
76
77 virtual ::std::shared_ptr<::RepositoryPacks const> getPacks() const /*override*/;
78 // NOLINTEND
79
80 public:
81 // virtual function thunks
82 // NOLINTBEGIN
83 MCNAPI ::std::shared_ptr<::RepositoryLoading::AllRefreshTaskData>
85
87
88 MCNAPI ::std::shared_ptr<::RepositoryPacks const> $getPacks() const;
89
90
91 // NOLINTEND
92 };
93
94public:
95 // member variables
96 // NOLINTBEGIN
97 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager>> mFilePathManager;
98 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::RepositoryPacks>>> mAllResourcePacks;
99 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::InvalidPacks>>> mInvalidPacks;
100 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::IRepositoryFactory>>> mFactory;
101 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::RepositorySources>>> mSources;
102 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PackSourceReport>> mPackSourceReport;
103 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::RepositoryLoading::VanillaPacks>>> mVanillaPacks;
104 ::ll::TypedStorage<8, 24, ::std::vector<::PackIdVersion>> mServicePacks;
105 ::ll::TypedStorage<8, 8, ::PackManifestFactory&> mManifestFactory;
106 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IContentAccessibilityProvider>> mContentAccessibility;
107 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mCurrentWorldPath;
108 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mCurrentPremiumWorldTemplatePath;
109 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ContentIdentity, ::std::string>> mTempCacheContentKeys;
110 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PackSettingsFactory>> mPackSettingsFactory;
111 ::ll::TypedStorage<8, 8, ::PackSourceFactory&> mPackSourceFactory;
112 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::PackCommand::IPackCommandPipeline>> mCommands;
113 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::TaskGroup>>> mTaskGroup;
114 ::ll::TypedStorage<8, 24, ::ContentIdentity> mCurrentPremiumWorldTemplateIdentity;
115 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::ResourcePackRepositoryRefreshQueue>>> mRefresher;
116 // NOLINTEND
117
118public:
119 LLAPI void addCustomResourcePackPath(std::filesystem::path const& path, PackType type);
120
121public:
122 // prevent constructor by default
123 ResourcePackRepository& operator=(ResourcePackRepository const&);
124 ResourcePackRepository(ResourcePackRepository const&);
125 ResourcePackRepository();
126
127public:
128 // virtual functions
129 // NOLINTBEGIN
130#ifdef LL_PLAT_S
131 virtual ~ResourcePackRepository() /*override*/;
132#else // LL_PLAT_C
133 virtual ~ResourcePackRepository() /*override*/ = default;
134#endif
135
136 virtual void getResourcePacksByPackId(
137 ::std::vector<::PackInstanceId> const& packInstanceIds,
138 ::std::vector<::PackInstance>& result
139 ) const /*override*/;
140
141 virtual ::std::shared_ptr<::ResourcePack> getResourcePackForPackId(::PackIdVersion const& idAndVersion) const
142 /*override*/;
143
144 virtual ::ResourcePack* getResourcePackOfDifferentVersionForPackId(::PackIdVersion const& idAndVersion) const
145 /*override*/;
146
147 virtual ::ResourcePack*
148 getResourcePackForPackIdInPath(::PackIdVersion const& idAndVersion, ::Core::Path const& fullPath) const
149 /*override*/;
150
151 virtual ::ResourcePack* getResourcePackByUUID(::mce::UUID const& id) const /*override*/;
152
153 virtual ::ResourcePack* getResourcePackForPackIdOwned(::PackIdVersion const& idAndVersion) const /*override*/;
154
155 virtual ::std::shared_ptr<::ResourcePack>
156 getResourcePackSatisfiesPackId(::PackIdVersion const& idAndVersion, bool requireOwnership) const /*override*/;
157
158 virtual ::ResourcePack* getResourcePackContainingModule(::PackIdVersion const& idAndVersion) const /*override*/;
159
160 virtual ::Bedrock::Threading::Async<::std::shared_ptr<::ResourcePack>>
161 getResourcePackInPath(::Core::Path const& path) const /*override*/;
162
163 virtual bool isResourcePackLoaded(::PackIdVersion const& identity, ::PackOrigin const& location) /*override*/;
164
165 virtual ::PackSourceReport const* getPackLoadingReport() const /*override*/;
166
167 virtual ::std::shared_ptr<::ResourcePack> getEditorPack() const /*override*/;
168
169 virtual ::std::shared_ptr<::ResourcePack> getVanillaPack() const /*override*/;
170
171 virtual bool setServicePacks(::std::vector<::PackIdVersion> servicePackIds) /*override*/;
172
173 virtual void addServicePacksToStack(::ResourcePackStack& stack) const /*override*/;
174
175 virtual void addSystemPacksToStack(::ResourcePackStack& stack) const /*override*/;
176
177 virtual void
178 addCachedResourcePacks(::std::unordered_map<::ContentIdentity, ::std::string> const* tempCacheKeys) /*override*/;
179
180 virtual void addWorldResourcePacks(::Core::Path const& levelPath) /*override*/;
181
182 virtual void addPremiumWorldTemplateResourcePacks(
183 ::Core::Path const& worldTemplatePath,
184 ::ContentIdentity const& premiumWorldIdentity
185 ) /*override*/;
186
187 virtual void addTempWorldTemplateResourcePacks(::mce::UUID const& worldTemplateUUID) /*override*/;
188
189 virtual void addWorldPackSource(::Core::Path const& levelPath) /*override*/;
190
191 virtual void addPremiumWorldTemplatePackSource(
192 ::Core::Path const& worldTemplatePath,
193 ::ContentIdentity const& premiumWorldIdentity
194 ) /*override*/;
195
196 virtual void removePacksLoadedFromCache() /*override*/;
197
198 virtual void removePacksLoadedFromWorld() /*override*/;
199
200 virtual ::Core::PathBuffer<::std::string> const getResourcePacksPath() const /*override*/;
201
202 virtual ::Core::PathBuffer<::std::string> const getBehaviorPacksPath() const /*override*/;
203
204 virtual ::Core::PathBuffer<::std::string> const getSkinPacksPath() const /*override*/;
205
206 virtual ::Core::PathBuffer<::std::string> const getCustomSkinDirectoryPath() const /*override*/;
207
208 virtual ::Core::PathBuffer<::std::string> const getDevelopmentResourcePacksPath() const /*override*/;
209
210 virtual ::Core::PathBuffer<::std::string> const getDevelopmentBehaviorPacksPath() const /*override*/;
211
212 virtual ::Core::PathBuffer<::std::string> const getDevelopmentSkinPacksPath() const /*override*/;
213
214 virtual ::Core::PathBuffer<::std::string> const getTreatmentPacksPath() const /*override*/;
215
216 virtual ::Core::PathBuffer<::std::string> const getSystemBehaviorPacksPath() const /*override*/;
217
218 virtual ::Core::PathBuffer<::std::string> const getSystemResourcePacksPath() const /*override*/;
219
220 virtual void refreshPacks() /*override*/;
221
222 virtual ::Bedrock::Threading::Async<void> refreshPacksAsync() /*override*/;
223
224 virtual void requestReloadUserPacks() /*override*/;
225
226 virtual ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> getKeyProvider() const /*override*/;
227
228 virtual ::PackManifestFactory& getPackManifestFactory() /*override*/;
229
230 virtual ::PackSettingsFactory& getPackSettingsFactory() const /*override*/;
231
232 virtual ::PackSourceFactory& getPackSourceFactory() /*override*/;
233
234 virtual ::std::vector<::ResourcePack*> getPacksByResourceLocation(::PackOrigin type) const /*override*/;
235
236 virtual ::std::vector<::ResourcePack*> getPacksByType(::PackType type) const /*override*/;
237
238 virtual ::std::vector<::gsl::not_null<::std::shared_ptr<::ResourcePack>>>
239 getPacksByCategory(::PackCategory category) const /*override*/;
240
241 virtual void forEachPack(::std::function<void(::ResourcePack const&)> const& callback) const /*override*/;
242
243 virtual ::std::vector<::ResourceLocation> const& getInvalidPacks(::PackType type) const /*override*/;
244
245 virtual ::std::vector<::ResourceLocation> getInvalidPacks(::InvalidPacksFilterGroup const& packTypes) const
246 /*override*/;
247
248 virtual void deletePack(::ResourceLocation const& packLocation) /*override*/;
249
250 virtual void deletePackFiles(::ResourceLocation const& packLocation) /*override*/;
251
252 virtual void postDeletePack(::ResourceLocation const& packLocation) /*override*/;
253
254 virtual void untrackInvalidPack(::ResourceLocation const& packLocation) /*override*/;
255
256 virtual bool isInitialized() const /*override*/;
257
258 virtual ::ResourcePackStack createStack(::std::vector<::PackInstanceId> const& identities) /*override*/;
259
260 virtual ::Bedrock::NotNullNonOwnerPtr<::IContentSourceRepository> getContentSourceRepository() /*override*/;
261 // NOLINTEND
262
263public:
264 // member functions
265 // NOLINTBEGIN
266 MCAPI ResourcePackRepository(
267 ::gsl::not_null<::std::shared_ptr<::RepositoryPacks>> repositoryPacks,
268 ::PackManifestFactory& manifestFactory,
269 ::Bedrock::NotNullNonOwnerPtr<::IContentAccessibilityProvider> const& contentAccessibility,
270 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& pathManager,
271 ::Bedrock::NonOwnerPointer<::PackCommand::IPackCommandPipeline> commands,
272 ::PackSourceFactory& packSourceFactory,
273 bool initAsync,
274 ::std::unique_ptr<::IRepositoryFactory> factory
275 );
276
277 MCAPI void _removePacksIf(::brstd::function_ref<bool(::ResourcePack const&)> callback);
278 // NOLINTEND
279
280public:
281 // constructor thunks
282 // NOLINTBEGIN
283 MCAPI void* $ctor(
284 ::gsl::not_null<::std::shared_ptr<::RepositoryPacks>> repositoryPacks,
285 ::PackManifestFactory& manifestFactory,
286 ::Bedrock::NotNullNonOwnerPtr<::IContentAccessibilityProvider> const& contentAccessibility,
287 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& pathManager,
288 ::Bedrock::NonOwnerPointer<::PackCommand::IPackCommandPipeline> commands,
289 ::PackSourceFactory& packSourceFactory,
290 bool initAsync,
291 ::std::unique_ptr<::IRepositoryFactory> factory
292 );
293 // NOLINTEND
294
295public:
296 // destructor thunk
297 // NOLINTBEGIN
298#ifdef LL_PLAT_S
299 MCAPI void $dtor();
300#endif
301 // NOLINTEND
302
303public:
304 // virtual function thunks
305 // NOLINTBEGIN
306 MCAPI void $getResourcePacksByPackId(
307 ::std::vector<::PackInstanceId> const& packInstanceIds,
308 ::std::vector<::PackInstance>& result
309 ) const;
310
311 MCAPI ::std::shared_ptr<::ResourcePack> $getResourcePackForPackId(::PackIdVersion const& idAndVersion) const;
312
313 MCAPI ::ResourcePack* $getResourcePackOfDifferentVersionForPackId(::PackIdVersion const& idAndVersion) const;
314
315 MCAPI ::ResourcePack*
316 $getResourcePackForPackIdInPath(::PackIdVersion const& idAndVersion, ::Core::Path const& fullPath) const;
317
318 MCAPI ::ResourcePack* $getResourcePackByUUID(::mce::UUID const& id) const;
319
320 MCAPI ::ResourcePack* $getResourcePackForPackIdOwned(::PackIdVersion const& idAndVersion) const;
321
322 MCAPI ::std::shared_ptr<::ResourcePack>
323 $getResourcePackSatisfiesPackId(::PackIdVersion const& idAndVersion, bool requireOwnership) const;
324
325 MCAPI ::ResourcePack* $getResourcePackContainingModule(::PackIdVersion const& idAndVersion) const;
326
327 MCAPI ::Bedrock::Threading::Async<::std::shared_ptr<::ResourcePack>>
328 $getResourcePackInPath(::Core::Path const& path) const;
329
330 MCAPI bool $isResourcePackLoaded(::PackIdVersion const& identity, ::PackOrigin const& location);
331
332 MCFOLD ::PackSourceReport const* $getPackLoadingReport() const;
333
334 MCAPI ::std::shared_ptr<::ResourcePack> $getEditorPack() const;
335
336 MCAPI ::std::shared_ptr<::ResourcePack> $getVanillaPack() const;
337
338 MCAPI bool $setServicePacks(::std::vector<::PackIdVersion> servicePackIds);
339
340 MCAPI void $addServicePacksToStack(::ResourcePackStack& stack) const;
341
342 MCAPI void $addSystemPacksToStack(::ResourcePackStack& stack) const;
343
344 MCAPI void $addCachedResourcePacks(::std::unordered_map<::ContentIdentity, ::std::string> const* tempCacheKeys);
345
346 MCAPI void $addWorldResourcePacks(::Core::Path const& levelPath);
347
348 MCAPI void $addPremiumWorldTemplateResourcePacks(
349 ::Core::Path const& worldTemplatePath,
350 ::ContentIdentity const& premiumWorldIdentity
351 );
352
353 MCAPI void $addTempWorldTemplateResourcePacks(::mce::UUID const& worldTemplateUUID);
354
355 MCAPI void $addWorldPackSource(::Core::Path const& levelPath);
356
357 MCAPI void $addPremiumWorldTemplatePackSource(
358 ::Core::Path const& worldTemplatePath,
359 ::ContentIdentity const& premiumWorldIdentity
360 );
361
362 MCAPI void $removePacksLoadedFromCache();
363
364 MCAPI void $removePacksLoadedFromWorld();
365
366 MCAPI ::Core::PathBuffer<::std::string> const $getResourcePacksPath() const;
367
368 MCAPI ::Core::PathBuffer<::std::string> const $getBehaviorPacksPath() const;
369
370 MCAPI ::Core::PathBuffer<::std::string> const $getSkinPacksPath() const;
371
372 MCAPI ::Core::PathBuffer<::std::string> const $getCustomSkinDirectoryPath() const;
373
374 MCAPI ::Core::PathBuffer<::std::string> const $getDevelopmentResourcePacksPath() const;
375
376 MCAPI ::Core::PathBuffer<::std::string> const $getDevelopmentBehaviorPacksPath() const;
377
378 MCAPI ::Core::PathBuffer<::std::string> const $getDevelopmentSkinPacksPath() const;
379
380 MCAPI ::Core::PathBuffer<::std::string> const $getTreatmentPacksPath() const;
381
382 MCAPI ::Core::PathBuffer<::std::string> const $getSystemBehaviorPacksPath() const;
383
384 MCAPI ::Core::PathBuffer<::std::string> const $getSystemResourcePacksPath() const;
385
386 MCAPI void $refreshPacks();
387
388 MCAPI ::Bedrock::Threading::Async<void> $refreshPacksAsync();
389
390 MCAPI void $requestReloadUserPacks();
391
392 MCAPI ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> $getKeyProvider() const;
393
394 MCFOLD ::PackManifestFactory& $getPackManifestFactory();
395
396 MCFOLD ::PackSettingsFactory& $getPackSettingsFactory() const;
397
398 MCFOLD ::PackSourceFactory& $getPackSourceFactory();
399
400 MCAPI ::std::vector<::ResourcePack*> $getPacksByResourceLocation(::PackOrigin type) const;
401
402 MCAPI ::std::vector<::ResourcePack*> $getPacksByType(::PackType type) const;
403
404 MCAPI ::std::vector<::gsl::not_null<::std::shared_ptr<::ResourcePack>>>
405 $getPacksByCategory(::PackCategory category) const;
406
407 MCAPI void $forEachPack(::std::function<void(::ResourcePack const&)> const& callback) const;
408
409 MCAPI ::std::vector<::ResourceLocation> const& $getInvalidPacks(::PackType type) const;
410
411 MCAPI ::std::vector<::ResourceLocation> $getInvalidPacks(::InvalidPacksFilterGroup const& packTypes) const;
412
413 MCAPI void $deletePack(::ResourceLocation const& packLocation);
414
415 MCAPI void $deletePackFiles(::ResourceLocation const& packLocation);
416
417 MCAPI void $postDeletePack(::ResourceLocation const& packLocation);
418
419 MCAPI void $untrackInvalidPack(::ResourceLocation const& packLocation);
420
421 MCAPI bool $isInitialized() const;
422
423 MCAPI ::ResourcePackStack $createStack(::std::vector<::PackInstanceId> const& identities);
424
425 MCAPI ::Bedrock::NotNullNonOwnerPtr<::IContentSourceRepository> $getContentSourceRepository();
426
427
428 // NOLINTEND
429};
Definition ContentIdentity.h:8
Definition FilePathManager.h:18
Definition Path.h:12
Definition IContentAccessibilityProvider.h:13
Definition IContentKeyProvider.h:13
Definition IContentSourceRepository.h:13
Definition IRepositoryFactory.h:12
Definition IResourcePackRepository.h:34
Definition InvalidPacks.h:13
Definition IPackCommandPipeline.h:19
Definition PackInstance.h:16
Definition PackManifestFactory.h:20
Definition PackSettingsFactory.h:23
Definition PackSourceFactory.h:33
Definition PackSourceReport.h:5
Definition Path.h:16
Definition IRepositoryLoader.h:14
Definition RepositoryPacks.h:19
Definition RepositorySources.h:14
Definition ResourceLocation.h:15
Definition ResourcePackRepositoryRefreshQueue.h:15
Definition ResourcePackRepository.h:56
MCAPI ::std::shared_ptr<::RepositoryPacks const > $getPacks() const
MCAPI void $applyTaskResults(::RepositoryLoading::AllRefreshTaskData &&taskData)
MCAPI ::std::shared_ptr<::RepositoryLoading::AllRefreshTaskData > $buildTaskData(::RepositoryLoading::BuildTaskDataOptions const &ops)
Definition ResourcePackStack.h:23
Definition ResourcePack.h:23
Definition TaskGroup.h:55
Definition UUID.h:7
STL namespace.
Definition InvalidPacksFilterGroup.h:5
Definition PackIdVersion.h:10
Definition PackInstanceId.h:8
Definition AllRefreshTaskData.h:7
Definition BuildTaskDataOptions.h:7
Definition VanillaPacks.h:7