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