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