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/deps/core/file/PathBuffer.h"
7#include "mc/deps/core/resource/ContentIdentity.h"
8#include "mc/deps/core/resource/PackCategory.h"
9#include "mc/deps/core/resource/PackIdVersion.h"
10#include "mc/deps/core/resource/PackOrigin.h"
11#include "mc/deps/core/resource/PackType.h"
12#include "mc/deps/core/resource/ResourceLocation.h"
13#include "mc/deps/core/threading/IAsyncResult.h"
14#include "mc/deps/core/utility/NonOwnerPointer.h"
15#include "mc/platform/threading/Mutex.h"
16#include "mc/resources/IResourcePackRepository.h"
17
18// auto generated forward declare list
19// clang-format off
25class Pack;
26class PackInstance;
29class PackSource;
32class ResourcePack;
34class SemVersion;
35class TaskGroup;
37struct PackInstanceId;
38namespace Core { class FilePathManager; }
39namespace Core { class Path; }
40namespace PackCommand { class IPackCommandPipeline; }
41namespace mce { class UUID; }
42// clang-format on
43
45public:
46 // ResourcePackRepository inner types declare
47 // clang-format off
48 struct KnownPackInfo;
49 // clang-format on
50
51 // ResourcePackRepository inner types define
53 public:
54 // member variables
55 // NOLINTBEGIN
56 ::ll::TypedStorage<1, 1, bool> mDiscoveredOnDisk;
57 ::ll::TypedStorage<8, 56, ::ResourceLocation> mResourceLocation;
58 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mPastHashes;
59 ::ll::TypedStorage<8, 48, ::PackIdVersion> mIdentity;
60 // NOLINTEND
61 };
62
63 using EventingCallback = ::std::function<::IMinecraftEventing&()>;
64
65public:
66 // member variables
67 // NOLINTBEGIN
68 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager>> mFilePathManager;
69 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::ResourcePack>>> mAllResourcePacks;
70 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CompositePackSource>> mPackSource;
71 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CompositePackSource>> mCachePackSource;
72 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CompositePackSource>> mWorldPackSource;
73 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CompositePackSource>> mPremiumWorldTemplatePackSource;
74 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CompositePackSource>> mTempWorldTemplatePackSource;
75 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PackSourceReport>> mPackSourceReport;
76 ::ll::TypedStorage<8, 8, ::ResourcePack*> mEditorPack;
77 ::ll::TypedStorage<8, 8, ::ResourcePack*> mVanillaPack;
78 ::ll::TypedStorage<8, 24, ::std::vector<::PackIdVersion>> mServicePacks;
79 ::ll::TypedStorage<8, 24, ::std::vector<::ResourceLocation>> mInvalidPackLocation;
80 ::ll::TypedStorage<8, 24, ::std::vector<::ResourceLocation>> mInvalidBehaviorPackLocation;
81 ::ll::TypedStorage<8, 24, ::std::vector<::ResourceLocation>> mInvalidResourcePackLocation;
82 ::ll::TypedStorage<8, 24, ::std::vector<::ResourceLocation>> mInvalidTemplatePackLocation;
83 ::ll::TypedStorage<8, 8, ::IMinecraftEventing&> mEventing;
84 ::ll::TypedStorage<8, 8, ::PackManifestFactory&> mManifestFactory;
85 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IContentAccessibilityProvider>> mContentAccessibility;
86 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mCurrentWorldPath;
87 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mCurrentPremiumWorldTemplatePath;
88 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ContentIdentity, ::std::string>> mTempCacheContentKeys;
89 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PackSettingsFactory>> mPackSettingsFactory;
90 ::ll::TypedStorage<8, 8, ::PackSourceFactory&> mPackSourceFactory;
91 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::PackCommand::IPackCommandPipeline>> mCommands;
92 ::ll::TypedStorage<8, 16, ::std::map<void*, ::std::function<void(::ResourcePack*)>>> mRemoveResourcePackCallback;
93 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::TaskGroup>> mInitTaskGroup;
94 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mInitializeMutex;
95 ::ll::TypedStorage<1, 1, bool> mCancelInitialization;
96 ::ll::TypedStorage<1, 1, bool> mInitialized;
97 ::ll::TypedStorage<1, 1, bool> mReloadUserPacksRequested;
98 ::ll::TypedStorage<1, 1, bool> mRefreshPacksRequested;
99 ::ll::TypedStorage<8, 24, ::ContentIdentity> mCurrentPremiumWorldTemplateIdentity;
100 // NOLINTEND
101
102public:
103 LLAPI void addCustomResourcePackPath(std::filesystem::path const& path, PackType type);
104
105public:
106 // prevent constructor by default
110
111public:
112 // virtual functions
113 // NOLINTBEGIN
114 // vIndex: 0
115 virtual ~ResourcePackRepository() /*override*/;
116
117 // vIndex: 1
118 virtual void getResourcePacksByPackId(
119 ::std::vector<::PackInstanceId> const& packInstanceIds,
120 ::std::vector<::PackInstance>& result
121 ) const /*override*/;
122
123 // vIndex: 2
124 virtual ::ResourcePack* getResourcePackForPackId(::PackIdVersion const& idAndVersion) const /*override*/;
125
126 // vIndex: 3
127 virtual ::ResourcePack* getResourcePackOfDifferentVersionForPackId(::PackIdVersion const& idAndVersion) const
128 /*override*/;
129
130 // vIndex: 4
131 virtual ::ResourcePack*
132 getResourcePackForPackIdInPath(::PackIdVersion const& idAndVersion, ::Core::Path const& fullPath) const
133 /*override*/;
134
135 // vIndex: 5
136 virtual ::ResourcePack* getResourcePackByUUID(::mce::UUID const& id) const /*override*/;
137
138 // vIndex: 6
139 virtual ::ResourcePack* getResourcePackForPackIdOwned(::PackIdVersion const& idAndVersion) const /*override*/;
140
141 // vIndex: 7
142 virtual ::ResourcePack*
143 getResourcePackSatisfiesPackId(::PackIdVersion const& idAndVersion, bool requireOwnership) const /*override*/;
144
145 // vIndex: 8
146 virtual ::ResourcePack* getResourcePackContainingModule(::PackIdVersion const& idAndVersion) const /*override*/;
147
148 // vIndex: 9
149 virtual ::ResourcePack* getResourcePackInPath(::Core::Path const& path) const /*override*/;
150
151 // vIndex: 10
152 virtual bool isResourcePackLoaded(::PackIdVersion const& identity, ::PackOrigin const& location) /*override*/;
153
154 // vIndex: 11
155 virtual ::PackSourceReport const* getPackLoadingReport() const /*override*/;
156
157 // vIndex: 12
158 virtual ::ResourcePack* getEditorPack() const /*override*/;
159
160 // vIndex: 13
161 virtual ::ResourcePack* getVanillaPack() const /*override*/;
162
163 // vIndex: 14
164 virtual bool setServicePacks(::std::vector<::PackIdVersion> servicePackIds) /*override*/;
165
166 // vIndex: 15
167 virtual bool hasServicePacks(::std::vector<::PackIdVersion> const& servicePacksIds) const /*override*/;
168
169 // vIndex: 16
170 virtual ::std::vector<::PackIdVersion> const& getServicePacks() const /*override*/;
171
172 // vIndex: 17
173 virtual void addServicePacksToStack(::ResourcePackStack& stack) const /*override*/;
174
175 // vIndex: 18
176 virtual void
177 addCachedResourcePacks(::std::unordered_map<::ContentIdentity, ::std::string> const* tempCacheKeys) /*override*/;
178
179 // vIndex: 19
180 virtual void addWorldResourcePacks(::Core::Path const& levelPath) /*override*/;
181
182 // vIndex: 20
183 virtual void addPremiumWorldTemplateResourcePacks(
184 ::Core::Path const& worldTemplatePath,
185 ::ContentIdentity const& premiumWorldIdentity
186 ) /*override*/;
187
188 // vIndex: 23
189 virtual void addTempWorldTemplateResourcePacks(::mce::UUID const& worldTemplateUUID) /*override*/;
190
191 // vIndex: 21
192 virtual void addWorldPackSource(::Core::Path const& levelPath) /*override*/;
193
194 // vIndex: 22
195 virtual void addPremiumWorldTemplatePackSource(
196 ::Core::Path const& worldTemplatePath,
197 ::ContentIdentity const& premiumWorldIdentity
198 ) /*override*/;
199
200 // vIndex: 24
201 virtual void removePacksLoadedFromCache() /*override*/;
202
203 // vIndex: 25
204 virtual void removePacksLoadedFromWorld() /*override*/;
205
206 // vIndex: 26
207 virtual ::Core::PathBuffer<::std::string> const getResourcePacksPath() const /*override*/;
208
209 // vIndex: 27
210 virtual ::Core::PathBuffer<::std::string> const getBehaviorPacksPath() const /*override*/;
211
212 // vIndex: 28
213 virtual ::Core::PathBuffer<::std::string> const getSkinPacksPath() const /*override*/;
214
215 // vIndex: 29
216 virtual ::Core::PathBuffer<::std::string> const getDevelopmentResourcePacksPath() const /*override*/;
217
218 // vIndex: 30
219 virtual ::Core::PathBuffer<::std::string> const getDevelopmentBehaviorPacksPath() const /*override*/;
220
221 // vIndex: 31
222 virtual ::Core::PathBuffer<::std::string> const getDevelopmentSkinPacksPath() const /*override*/;
223
224 // vIndex: 32
225 virtual ::Core::PathBuffer<::std::string> const getTreatmentPacksPath() const /*override*/;
226
227 // vIndex: 33
228 virtual void refreshPacks() /*override*/;
229
230 // vIndex: 34
231 virtual ::std::shared_ptr<::Bedrock::Threading::IAsyncResult<void>> refreshPacksAsync() /*override*/;
232
233 // vIndex: 35
234 virtual void requestReloadUserPacks() /*override*/;
235
236 // vIndex: 36
237 virtual ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> getKeyProvider() const /*override*/;
238
239 // vIndex: 37
240 virtual ::PackManifestFactory& getPackManifestFactory() /*override*/;
241
242 // vIndex: 38
243 virtual ::PackSettingsFactory& getPackSettingsFactory() const /*override*/;
244
245 // vIndex: 39
246 virtual ::PackSourceFactory& getPackSourceFactory() /*override*/;
247
248 // vIndex: 40
249 virtual ::CompositePackSource const* getWorldPackSource() const /*override*/;
250
251 // vIndex: 41
252 virtual ::std::vector<::ResourcePack*> getPacksByResourceLocation(::PackOrigin type) const /*override*/;
253
254 // vIndex: 42
255 virtual ::std::vector<::ResourcePack*> getPacksByType(::PackType type) const /*override*/;
256
257 // vIndex: 43
258 virtual ::std::vector<::ResourcePack*> getPacksByCategory(::PackCategory category) const /*override*/;
259
260 // vIndex: 44
261 virtual void forEachPack(::std::function<void(::ResourcePack const&)> const& callback) const /*override*/;
262
263 // vIndex: 45
264 virtual void addInvalidPack(::ResourceLocation const& packLocation, ::PackType type) /*override*/;
265
266 // vIndex: 47
267 virtual ::std::vector<::ResourceLocation> const& getInvalidPacks(::PackType type) const /*override*/;
268
269 // vIndex: 46
270 virtual ::std::vector<::ResourceLocation> getInvalidPacks(::InvalidPacksFilterGroup const& packTypes) const
271 /*override*/;
272
273 // vIndex: 48
274 virtual void deletePack(::ResourceLocation const& packLocation) /*override*/;
275
276 // vIndex: 49
277 virtual void deletePackFiles(::ResourceLocation const& packLocation) /*override*/;
278
279 // vIndex: 50
280 virtual void postDeletePack(::ResourceLocation const& packLocation) /*override*/;
281
282 // vIndex: 51
283 virtual void untrackInvalidPack(::ResourceLocation const& packLocation) /*override*/;
284
285 // vIndex: 52
286 virtual void
287 registerResourcePackRemovedCallback(void* ptr, ::std::function<void(::ResourcePack*)> callback) /*override*/;
288
289 // vIndex: 53
290 virtual void unregisterResourcePackRemovedCallback(void* ptr) /*override*/;
291
292 // vIndex: 54
293 virtual bool isInitialized() const /*override*/;
294 // NOLINTEND
295
296public:
297 // member functions
298 // NOLINTBEGIN
300 ::IMinecraftEventing& eventing,
301 ::PackManifestFactory& manifestFactory,
302 ::Bedrock::NotNullNonOwnerPtr<::IContentAccessibilityProvider> const& contentAccessibility,
303 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& pathManager,
304 ::Bedrock::NonOwnerPointer<::PackCommand::IPackCommandPipeline> commands,
305 ::PackSourceFactory& packSourceFactory,
306 bool initAsync
307 );
308
309 MCAPI bool _addResourcePackIfNotAlreadyAdded(::Pack& pack);
310
311 MCAPI void _findVanillaPacks();
312
313 MCAPI void _initialize();
314
315 MCAPI void _initializeCachedPackSource();
316
317 MCAPI void _initializePackSource();
318
319 MCAPI void _initializeWorldPackSource();
320
321 MCAPI void _loadPacks();
322
323 MCAPI bool _packExists(::mce::UUID const& packId, ::SemVersion const& version, ::PackOrigin origin) const;
324
325 MCAPI void _reloadUserPacks();
326
327 MCAPI bool _removePack(::ResourceLocation const& packLocation, bool unregisterDeleteCallback);
328
329 MCAPI void _triggerRemoveResourcePackCallback(::ResourcePack* resourcePack);
330
331 MCAPI void _validateDependencies();
332 // NOLINTEND
333
334public:
335 // static functions
336 // NOLINTBEGIN
337 MCAPI static ::PackSourceReport loadAndUpgradePacks(
338 ::PackSource& packSource,
339 ::IPackManifestFactory& manifestFactory,
340 ::IContentKeyProvider const& keyProvider,
341 ::PackCommand::IPackCommandPipeline* commands
342 );
343 // NOLINTEND
344
345public:
346 // static variables
347 // NOLINTBEGIN
348 MCAPI static ::std::set<::mce::UUID>& CHEMISTRY_PACK_UUIDS();
349 // NOLINTEND
350
351public:
352 // constructor thunks
353 // NOLINTBEGIN
354 MCAPI void* $ctor(
355 ::IMinecraftEventing& eventing,
356 ::PackManifestFactory& manifestFactory,
357 ::Bedrock::NotNullNonOwnerPtr<::IContentAccessibilityProvider> const& contentAccessibility,
358 ::Bedrock::NotNullNonOwnerPtr<::Core::FilePathManager> const& pathManager,
359 ::Bedrock::NonOwnerPointer<::PackCommand::IPackCommandPipeline> commands,
360 ::PackSourceFactory& packSourceFactory,
361 bool initAsync
362 );
363 // NOLINTEND
364
365public:
366 // destructor thunk
367 // NOLINTBEGIN
368 MCAPI void $dtor();
369 // NOLINTEND
370
371public:
372 // virtual function thunks
373 // NOLINTBEGIN
374 MCAPI void $getResourcePacksByPackId(
375 ::std::vector<::PackInstanceId> const& packInstanceIds,
376 ::std::vector<::PackInstance>& result
377 ) const;
378
379 MCAPI ::ResourcePack* $getResourcePackForPackId(::PackIdVersion const& idAndVersion) const;
380
381 MCAPI ::ResourcePack* $getResourcePackOfDifferentVersionForPackId(::PackIdVersion const& idAndVersion) const;
382
383 MCAPI ::ResourcePack*
384 $getResourcePackForPackIdInPath(::PackIdVersion const& idAndVersion, ::Core::Path const& fullPath) const;
385
386 MCAPI ::ResourcePack* $getResourcePackByUUID(::mce::UUID const& id) const;
387
388 MCAPI ::ResourcePack* $getResourcePackForPackIdOwned(::PackIdVersion const& idAndVersion) const;
389
390 MCAPI ::ResourcePack*
391 $getResourcePackSatisfiesPackId(::PackIdVersion const& idAndVersion, bool requireOwnership) const;
392
393 MCAPI ::ResourcePack* $getResourcePackContainingModule(::PackIdVersion const& idAndVersion) const;
394
395 MCAPI ::ResourcePack* $getResourcePackInPath(::Core::Path const& path) const;
396
397 MCAPI bool $isResourcePackLoaded(::PackIdVersion const& identity, ::PackOrigin const& location);
398
399 MCFOLD ::PackSourceReport const* $getPackLoadingReport() const;
400
401 MCFOLD ::ResourcePack* $getEditorPack() const;
402
403 MCFOLD ::ResourcePack* $getVanillaPack() const;
404
405 MCAPI bool $setServicePacks(::std::vector<::PackIdVersion> servicePackIds);
406
407 MCAPI bool $hasServicePacks(::std::vector<::PackIdVersion> const& servicePacksIds) const;
408
409 MCFOLD ::std::vector<::PackIdVersion> const& $getServicePacks() const;
410
411 MCAPI void $addServicePacksToStack(::ResourcePackStack& stack) const;
412
413 MCAPI void $addCachedResourcePacks(::std::unordered_map<::ContentIdentity, ::std::string> const* tempCacheKeys);
414
415 MCAPI void $addWorldResourcePacks(::Core::Path const& levelPath);
416
417 MCAPI void $addPremiumWorldTemplateResourcePacks(
418 ::Core::Path const& worldTemplatePath,
419 ::ContentIdentity const& premiumWorldIdentity
420 );
421
422 MCAPI void $addTempWorldTemplateResourcePacks(::mce::UUID const& worldTemplateUUID);
423
424 MCAPI void $addWorldPackSource(::Core::Path const& levelPath);
425
426 MCAPI void $addPremiumWorldTemplatePackSource(
427 ::Core::Path const& worldTemplatePath,
428 ::ContentIdentity const& premiumWorldIdentity
429 );
430
431 MCAPI void $removePacksLoadedFromCache();
432
433 MCAPI void $removePacksLoadedFromWorld();
434
435 MCAPI ::Core::PathBuffer<::std::string> const $getResourcePacksPath() const;
436
437 MCAPI ::Core::PathBuffer<::std::string> const $getBehaviorPacksPath() const;
438
439 MCAPI ::Core::PathBuffer<::std::string> const $getSkinPacksPath() const;
440
441 MCAPI ::Core::PathBuffer<::std::string> const $getDevelopmentResourcePacksPath() const;
442
443 MCAPI ::Core::PathBuffer<::std::string> const $getDevelopmentBehaviorPacksPath() const;
444
445 MCAPI ::Core::PathBuffer<::std::string> const $getDevelopmentSkinPacksPath() const;
446
447 MCAPI ::Core::PathBuffer<::std::string> const $getTreatmentPacksPath() const;
448
449 MCAPI void $refreshPacks();
450
451 MCAPI ::std::shared_ptr<::Bedrock::Threading::IAsyncResult<void>> $refreshPacksAsync();
452
453 MCAPI void $requestReloadUserPacks();
454
455 MCAPI ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const> $getKeyProvider() const;
456
457 MCFOLD ::PackManifestFactory& $getPackManifestFactory();
458
459 MCFOLD ::PackSettingsFactory& $getPackSettingsFactory() const;
460
461 MCAPI ::PackSourceFactory& $getPackSourceFactory();
462
463 MCFOLD ::CompositePackSource const* $getWorldPackSource() const;
464
465 MCAPI ::std::vector<::ResourcePack*> $getPacksByResourceLocation(::PackOrigin type) const;
466
467 MCAPI ::std::vector<::ResourcePack*> $getPacksByType(::PackType type) const;
468
469 MCAPI ::std::vector<::ResourcePack*> $getPacksByCategory(::PackCategory category) const;
470
471 MCAPI void $forEachPack(::std::function<void(::ResourcePack const&)> const& callback) const;
472
473 MCAPI void $addInvalidPack(::ResourceLocation const& packLocation, ::PackType type);
474
475 MCAPI ::std::vector<::ResourceLocation> const& $getInvalidPacks(::PackType type) const;
476
477 MCAPI ::std::vector<::ResourceLocation> $getInvalidPacks(::InvalidPacksFilterGroup const& packTypes) const;
478
479 MCAPI void $deletePack(::ResourceLocation const& packLocation);
480
481 MCAPI void $deletePackFiles(::ResourceLocation const& packLocation);
482
483 MCAPI void $postDeletePack(::ResourceLocation const& packLocation);
484
485 MCAPI void $untrackInvalidPack(::ResourceLocation const& packLocation);
486
487 MCAPI void $registerResourcePackRemovedCallback(void* ptr, ::std::function<void(::ResourcePack*)> callback);
488
489 MCAPI void $unregisterResourcePackRemovedCallback(void* ptr);
490
491 MCAPI bool $isInitialized() const;
492 // NOLINTEND
493
494public:
495 // vftables
496 // NOLINTBEGIN
497 MCNAPI static void** $vftable();
498 // NOLINTEND
499};
Definition CompositePackSource.h:15
Definition ContentIdentity.h:8
Definition Path.h:17
Definition IContentAccessibilityProvider.h:13
Definition IContentKeyProvider.h:13
Definition IMinecraftEventing.h:144
Definition IPackManifestFactory.h:14
Definition IResourcePackRepository.h:34
Definition PackInstance.h:23
Definition PackManifestFactory.h:20
Definition PackSettingsFactory.h:13
Definition PackSourceFactory.h:33
Definition PackSourceReport.h:5
Definition PackSource.h:23
Definition Pack.h:28
Definition Path.h:16
Definition ResourceLocation.h:14
Definition ResourcePackRepository.h:44
static MCAPI void ** $vftable()
Definition ResourcePackStack.h:21
Definition ResourcePack.h:25
Definition SemVersion.h:16
Definition TaskGroup.h:39
Definition UUID.h:7
STL namespace.
Definition InvalidPacksFilterGroup.h:5
Definition PackIdVersion.h:10
Definition PackInstanceId.h:8
Definition ResourcePackRepository.h:52