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 public:
94 // vftables
95 // NOLINTBEGIN
96 MCNAPI static void** $vftable();
97 // NOLINTEND
98 };
99
100public:
101 // member variables
102 // NOLINTBEGIN
103 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager>> mFilePathManager;
104 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::RepositoryPacks>>> mAllResourcePacks;
105 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::InvalidPacks>>> mInvalidPacks;
106 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::IRepositoryFactory>>> mFactory;
107 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::RepositorySources>>> mSources;
108 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PackSourceReport>> mPackSourceReport;
109 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::RepositoryLoading::VanillaPacks>>> mVanillaPacks;
110 ::ll::TypedStorage<8, 24, ::std::vector<::PackIdVersion>> mServicePacks;
111 ::ll::TypedStorage<8, 8, ::PackManifestFactory&> mManifestFactory;
112 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IContentAccessibilityProvider>> mContentAccessibility;
113 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mCurrentWorldPath;
114 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mCurrentPremiumWorldTemplatePath;
115 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ContentIdentity, ::std::string>> mTempCacheContentKeys;
116 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PackSettingsFactory>> mPackSettingsFactory;
117 ::ll::TypedStorage<8, 8, ::PackSourceFactory&> mPackSourceFactory;
118 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::PackCommand::IPackCommandPipeline>> mCommands;
119 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::TaskGroup>>> mTaskGroup;
120 ::ll::TypedStorage<8, 24, ::ContentIdentity> mCurrentPremiumWorldTemplateIdentity;
121 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::ResourcePackRepositoryRefreshQueue>>> mRefresher;
122 // NOLINTEND
123
124public:
125 LLAPI void addCustomResourcePackPath(std::filesystem::path const& path, PackType type);
126
127public:
128 // prevent constructor by default
129 ResourcePackRepository& operator=(ResourcePackRepository const&);
130 ResourcePackRepository(ResourcePackRepository const&);
131 ResourcePackRepository();
132
133public:
134 // virtual functions
135 // NOLINTBEGIN
136 virtual ~ResourcePackRepository() /*override*/;
137
138 virtual void getResourcePacksByPackId(
139 ::std::vector<::PackInstanceId> const& packInstanceIds,
140 ::std::vector<::PackInstance>& result
141 ) const /*override*/;
142
143 virtual ::std::shared_ptr<::ResourcePack> getResourcePackForPackId(::PackIdVersion const& idAndVersion) const
144 /*override*/;
145
146 virtual ::ResourcePack* getResourcePackOfDifferentVersionForPackId(::PackIdVersion const& idAndVersion) const
147 /*override*/;
148
149 virtual ::ResourcePack*
150 getResourcePackForPackIdInPath(::PackIdVersion const& idAndVersion, ::Core::Path const& fullPath) const
151 /*override*/;
152
153 virtual ::ResourcePack* getResourcePackByUUID(::mce::UUID const& id) const /*override*/;
154
155 virtual ::ResourcePack* getResourcePackForPackIdOwned(::PackIdVersion const& idAndVersion) const /*override*/;
156
157 virtual ::std::shared_ptr<::ResourcePack>
158 getResourcePackSatisfiesPackId(::PackIdVersion const& idAndVersion, bool requireOwnership) const /*override*/;
159
160 virtual ::ResourcePack* getResourcePackContainingModule(::PackIdVersion const& idAndVersion) const /*override*/;
161
162 virtual ::Bedrock::Threading::Async<::std::shared_ptr<::ResourcePack>>
163 getResourcePackInPath(::Core::Path const& path) const /*override*/;
164
165 virtual bool isResourcePackLoaded(::PackIdVersion const& identity, ::PackOrigin const& location) /*override*/;
166
167 virtual ::PackSourceReport const* getPackLoadingReport() const /*override*/;
168
169 virtual ::std::shared_ptr<::ResourcePack> getEditorPack() const /*override*/;
170
171 virtual ::std::shared_ptr<::ResourcePack> getVanillaPack() const /*override*/;
172
173 virtual bool setServicePacks(::std::vector<::PackIdVersion> servicePackIds) /*override*/;
174
175 virtual void addServicePacksToStack(::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 void refreshPacks() /*override*/;
217
218 virtual ::Bedrock::Threading::Async<void> refreshPacksAsync() /*override*/;
219
220 virtual void requestReloadUserPacks() /*override*/;
221
222 virtual ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> getKeyProvider() const /*override*/;
223
224 virtual ::PackManifestFactory& getPackManifestFactory() /*override*/;
225
226 virtual ::PackSettingsFactory& getPackSettingsFactory() const /*override*/;
227
228 virtual ::PackSourceFactory& getPackSourceFactory() /*override*/;
229
230 virtual ::std::vector<::ResourcePack*> getPacksByResourceLocation(::PackOrigin type) const /*override*/;
231
232 virtual ::std::vector<::ResourcePack*> getPacksByType(::PackType type) const /*override*/;
233
234 virtual ::std::vector<::gsl::not_null<::std::shared_ptr<::ResourcePack>>>
235 getPacksByCategory(::PackCategory category) const /*override*/;
236
237 virtual void forEachPack(::std::function<void(::ResourcePack const&)> const& callback) const /*override*/;
238
239 virtual ::std::vector<::ResourceLocation> const& getInvalidPacks(::PackType type) const /*override*/;
240
241 virtual ::std::vector<::ResourceLocation> getInvalidPacks(::InvalidPacksFilterGroup const& packTypes) const
242 /*override*/;
243
244 virtual void deletePack(::ResourceLocation const& packLocation) /*override*/;
245
246 virtual void deletePackFiles(::ResourceLocation const& packLocation) /*override*/;
247
248 virtual void postDeletePack(::ResourceLocation const& packLocation) /*override*/;
249
250 virtual void untrackInvalidPack(::ResourceLocation const& packLocation) /*override*/;
251
252 virtual bool isInitialized() const /*override*/;
253
254 virtual ::ResourcePackStack createStack(::std::vector<::PackInstanceId> const& identities) /*override*/;
255
256 virtual ::Bedrock::NotNullNonOwnerPtr<::IContentSourceRepository> getContentSourceRepository() /*override*/;
257 // NOLINTEND
258
259public:
260 // member functions
261 // NOLINTBEGIN
262 MCAPI ResourcePackRepository(
263 ::gsl::not_null<::std::shared_ptr<::RepositoryPacks>> repositoryPacks,
264 ::PackManifestFactory& manifestFactory,
265 ::Bedrock::NotNullNonOwnerPtr<::IContentAccessibilityProvider> const& contentAccessibility,
266 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& pathManager,
267 ::Bedrock::NonOwnerPointer<::PackCommand::IPackCommandPipeline> commands,
268 ::PackSourceFactory& packSourceFactory,
269 bool initAsync,
270 ::std::unique_ptr<::IRepositoryFactory> factory
271 );
272
273 MCAPI void _removePacksIf(::brstd::function_ref<bool(::ResourcePack const&)> callback);
274
275#ifdef LL_PLAT_C
276 MCAPI void cancelInitialization();
277#endif
278 // NOLINTEND
279
280public:
281 // static functions
282 // NOLINTBEGIN
283 MCAPI static ::Core::PathBuffer<::std::string> getBehaviorPacksPath(::Core::FilePathManager const& paths);
284
285 MCAPI static ::Core::PathBuffer<::std::string> getCustomSkinDirectoryPath(::Core::FilePathManager const& paths);
286
287 MCAPI static ::Core::PathBuffer<::std::string>
288 getDevelopmentBehaviorPacksPath(::Core::FilePathManager const& paths);
289
290 MCAPI static ::Core::PathBuffer<::std::string>
291 getDevelopmentResourcePacksPath(::Core::FilePathManager const& paths);
292
293 MCAPI static ::Core::PathBuffer<::std::string> getDevelopmentSkinPacksPath(::Core::FilePathManager const& paths);
294
295 MCAPI static ::Core::PathBuffer<::std::string> getResourcePacksPath(::Core::FilePathManager const& paths);
296
297 MCAPI static ::Core::PathBuffer<::std::string> getSkinPacksPath(::Core::FilePathManager const& paths);
298 // NOLINTEND
299
300public:
301 // constructor thunks
302 // NOLINTBEGIN
303 MCAPI void* $ctor(
304 ::gsl::not_null<::std::shared_ptr<::RepositoryPacks>> repositoryPacks,
305 ::PackManifestFactory& manifestFactory,
306 ::Bedrock::NotNullNonOwnerPtr<::IContentAccessibilityProvider> const& contentAccessibility,
307 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& pathManager,
309 ::PackSourceFactory& packSourceFactory,
310 bool initAsync,
311 ::std::unique_ptr<::IRepositoryFactory> factory
312 );
313 // NOLINTEND
314
315public:
316 // destructor thunk
317 // NOLINTBEGIN
318 MCAPI void $dtor();
319 // NOLINTEND
320
321public:
322 // virtual function thunks
323 // NOLINTBEGIN
324 MCAPI void $getResourcePacksByPackId(
325 ::std::vector<::PackInstanceId> const& packInstanceIds,
326 ::std::vector<::PackInstance>& result
327 ) const;
328
329 MCAPI ::std::shared_ptr<::ResourcePack> $getResourcePackForPackId(::PackIdVersion const& idAndVersion) const;
330
331 MCAPI ::ResourcePack* $getResourcePackOfDifferentVersionForPackId(::PackIdVersion const& idAndVersion) const;
332
333 MCAPI ::ResourcePack*
334 $getResourcePackForPackIdInPath(::PackIdVersion const& idAndVersion, ::Core::Path const& fullPath) const;
335
336 MCAPI ::ResourcePack* $getResourcePackByUUID(::mce::UUID const& id) const;
337
338 MCAPI ::ResourcePack* $getResourcePackForPackIdOwned(::PackIdVersion const& idAndVersion) const;
339
340 MCAPI ::std::shared_ptr<::ResourcePack>
341 $getResourcePackSatisfiesPackId(::PackIdVersion const& idAndVersion, bool requireOwnership) const;
342
343 MCAPI ::ResourcePack* $getResourcePackContainingModule(::PackIdVersion const& idAndVersion) const;
344
345 MCAPI ::Bedrock::Threading::Async<::std::shared_ptr<::ResourcePack>>
346 $getResourcePackInPath(::Core::Path const& path) const;
347
348 MCAPI bool $isResourcePackLoaded(::PackIdVersion const& identity, ::PackOrigin const& location);
349
350 MCFOLD ::PackSourceReport const* $getPackLoadingReport() const;
351
352 MCAPI ::std::shared_ptr<::ResourcePack> $getEditorPack() const;
353
354 MCAPI ::std::shared_ptr<::ResourcePack> $getVanillaPack() const;
355
356 MCAPI bool $setServicePacks(::std::vector<::PackIdVersion> servicePackIds);
357
358 MCAPI void $addServicePacksToStack(::ResourcePackStack& stack) const;
359
360 MCAPI void $addCachedResourcePacks(::std::unordered_map<::ContentIdentity, ::std::string> const* tempCacheKeys);
361
362 MCAPI void $addWorldResourcePacks(::Core::Path const& levelPath);
363
364 MCAPI void $addPremiumWorldTemplateResourcePacks(
365 ::Core::Path const& worldTemplatePath,
366 ::ContentIdentity const& premiumWorldIdentity
367 );
368
369 MCAPI void $addTempWorldTemplateResourcePacks(::mce::UUID const& worldTemplateUUID);
370
371 MCAPI void $addWorldPackSource(::Core::Path const& levelPath);
372
373 MCAPI void $addPremiumWorldTemplatePackSource(
374 ::Core::Path const& worldTemplatePath,
375 ::ContentIdentity const& premiumWorldIdentity
376 );
377
378 MCAPI void $removePacksLoadedFromCache();
379
380 MCAPI void $removePacksLoadedFromWorld();
381
382 MCAPI ::Core::PathBuffer<::std::string> const $getResourcePacksPath() const;
383
384 MCAPI ::Core::PathBuffer<::std::string> const $getBehaviorPacksPath() const;
385
386 MCAPI ::Core::PathBuffer<::std::string> const $getSkinPacksPath() const;
387
388 MCAPI ::Core::PathBuffer<::std::string> const $getCustomSkinDirectoryPath() const;
389
390 MCAPI ::Core::PathBuffer<::std::string> const $getDevelopmentResourcePacksPath() const;
391
392 MCAPI ::Core::PathBuffer<::std::string> const $getDevelopmentBehaviorPacksPath() const;
393
394 MCAPI ::Core::PathBuffer<::std::string> const $getDevelopmentSkinPacksPath() const;
395
396 MCAPI ::Core::PathBuffer<::std::string> const $getTreatmentPacksPath() const;
397
398 MCAPI void $refreshPacks();
399
400 MCAPI ::Bedrock::Threading::Async<void> $refreshPacksAsync();
401
402 MCAPI void $requestReloadUserPacks();
403
404 MCAPI ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> $getKeyProvider() const;
405
406 MCFOLD ::PackManifestFactory& $getPackManifestFactory();
407
408 MCFOLD ::PackSettingsFactory& $getPackSettingsFactory() const;
409
410 MCFOLD ::PackSourceFactory& $getPackSourceFactory();
411
412 MCAPI ::std::vector<::ResourcePack*> $getPacksByResourceLocation(::PackOrigin type) const;
413
414 MCAPI ::std::vector<::ResourcePack*> $getPacksByType(::PackType type) const;
415
416 MCAPI ::std::vector<::gsl::not_null<::std::shared_ptr<::ResourcePack>>>
417 $getPacksByCategory(::PackCategory category) const;
418
419 MCAPI void $forEachPack(::std::function<void(::ResourcePack const&)> const& callback) const;
420
421 MCAPI ::std::vector<::ResourceLocation> const& $getInvalidPacks(::PackType type) const;
422
423 MCAPI ::std::vector<::ResourceLocation> $getInvalidPacks(::InvalidPacksFilterGroup const& packTypes) const;
424
425 MCAPI void $deletePack(::ResourceLocation const& packLocation);
426
427 MCAPI void $deletePackFiles(::ResourceLocation const& packLocation);
428
429 MCAPI void $postDeletePack(::ResourceLocation const& packLocation);
430
431 MCAPI void $untrackInvalidPack(::ResourceLocation const& packLocation);
432
433 MCAPI bool $isInitialized() const;
434
435 MCAPI ::ResourcePackStack $createStack(::std::vector<::PackInstanceId> const& identities);
436
437 MCAPI ::Bedrock::NotNullNonOwnerPtr<::IContentSourceRepository> $getContentSourceRepository();
438
439
440 // NOLINTEND
441
442public:
443 // vftables
444 // NOLINTBEGIN
446
448 // NOLINTEND
449};
Definition NonOwnerPointer.h:9
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:14
Definition IPackCommandPipeline.h:19
Definition PackInstance.h:28
Definition PackManifestFactory.h:21
Definition PackSettingsFactory.h:24
Definition PackSourceFactory.h:34
Definition PackSourceReport.h:11
Definition Path.h:16
Definition IRepositoryLoader.h:14
Definition RepositoryPacks.h:20
Definition RepositorySources.h:15
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)
static MCAPI void ** $vftableForIContentSourceRepository()
static MCAPI void ** $vftableForIResourcePackRepository()
Definition ResourcePackStack.h:24
Definition ResourcePack.h:28
Definition TaskGroup.h:55
Definition UUID.h:7
STL namespace.
Definition InvalidPacksFilterGroup.h:8
Definition PackIdVersion.h:10
Definition PackInstanceId.h:8
Definition AllRefreshTaskData.h:7
Definition BuildTaskDataOptions.h:7
Definition VanillaPacks.h:7