LeviLamina
Loading...
Searching...
No Matches
ResourcePack.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/resources/PackIconType.h"
8#include "mc/resources/ResourceSignature.h"
9
10// auto generated forward declare list
11// clang-format off
12class I18n;
13class Pack;
18struct SubpackInfo;
19namespace Bedrock::Resources { class PreloadedPathHandle; }
20namespace Core { class Path; }
21namespace Core { class PathView; }
22namespace Json { class Value; }
23// clang-format on
24
25class ResourcePack {
26public:
27 // ResourcePack inner types declare
28 // clang-format off
29 struct Impl;
30 // clang-format on
31
32 // ResourcePack inner types define
33 struct Impl {
34 public:
35 // member variables
36 // NOLINTBEGIN
37 ::ll::TypedStorage<1, 1, bool> mHidden;
38 ::ll::TypedStorage<1, 1, bool> mError;
39 ::ll::TypedStorage<8, 16, ::gsl::not_null<::std::shared_ptr<::Pack>>> mPack;
40 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PackAccessStrategy>> mSubpackAccessStrategy;
41 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::Pack>>> mSubPacks;
42 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::ResourcePack>>> mSubResourcePacks;
43 ::ll::TypedStorage<8, 32, ::std::string const> mNameWithVersionForTelemetry;
44 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mIconPath;
45 ::ll::TypedStorage<8, 8, double> mLoadTime;
46 ::ll::TypedStorage<1, 1, bool> mIsBaseGamePack;
47 ::ll::TypedStorage<1, 1, bool> mIsSlicePack;
48 ::ll::TypedStorage<8, 64, ::ResourceSignature> mResourceSignature;
49 ::ll::TypedStorage<1, 1, bool> mIsMarkedForRemoval;
50 ::ll::TypedStorage<8, 8, ::std::atomic<double>> mAssetReadMs;
51 ::ll::TypedStorage<8, 8, ::std::atomic<uint64>> mAssetReadBytes;
52 // NOLINTEND
53
54 public:
55 // member functions
56 // NOLINTBEGIN
57 MCAPI ~Impl();
58 // NOLINTEND
59
60 public:
61 // destructor thunk
62 // NOLINTBEGIN
63 MCAPI void $dtor();
64 // NOLINTEND
65 };
66
67 using Callback = ::std::function<void(::Core::Path const&)>;
68
69public:
70 // member variables
71 // NOLINTBEGIN
72 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::ResourcePack::Impl>>> mImpl;
73 // NOLINTEND
74
75public:
76 // prevent constructor by default
77 ResourcePack();
78
79public:
80 // member functions
81 // NOLINTBEGIN
82 MCAPI ResourcePack(::I18n& loc, ::gsl::not_null<::std::shared_ptr<::Pack>> pack);
83
84 MCAPI void _createSubpack(::I18n& loc, ::SubpackInfo const& subpackInfo);
85
86 MCAPI void _createSubpacks(::I18n& loc);
87
88#ifdef LL_PLAT_C
89 MCAPI void _gatherBehaviorPackTelemetry(::BehaviorPackContents& counts) const;
90
91 MCAPI void _gatherResourcePackTelemetry(::ResourcePackContents& counts) const;
92#endif
93
94 MCAPI bool areKnownFilesValid();
95
96 MCAPI void forEachIn(
97 ::Core::Path const& filePath,
98 ::std::function<void(::Core::Path const&)> callback,
99 int subpackIndex,
100 bool recurseAnyways
101 ) const;
102
103 MCAPI void forEachInAssetSet(
104 ::Core::Path const& filePath,
105 ::std::function<void(::Core::Path const&)> callback,
106 int subpackIndex
107 ) const;
108
109 MCAPI void generateAssetSet();
110
111#ifdef LL_PLAT_C
112 MCAPI ::Core::PathBuffer<::std::string> getIconPath(::PackIconType iconType) const;
113#endif
114
115 MCAPI bool getResource(::Core::Path const& resourceName, ::std::string& resourceStream, int subpackIndex) const;
116
117#ifdef LL_PLAT_C
118 MCAPI ::std::optional<::StreamableAssetSource> getStreamableSource(
119 ::Core::Path const& resourceName,
120 int subpackIndex,
121 ::std::optional<::Core::PathView> tempDirectory
122 ) const;
123
124 MCAPI ::Json::Value getTexturesList(int subpackIndex) const;
125
126 MCAPI bool hasExtraResourcesForLocale(::std::string const& code, int subpackIndex) const;
127
128 MCAPI bool hasIcon(::PackIconType iconType) const;
129#endif
130
131 MCAPI bool hasResource(::Core::Path const& resourceName, int subpackIndex) const;
132
133#ifdef LL_PLAT_C
134 MCAPI void invalidatePreloadCache();
135#endif
136
137 MCAPI bool isAssetExtractionViable() const;
138
139 MCAPI ::Bedrock::Resources::PreloadedPathHandle
140 preloadArchive(::Core::Path const& packRelativePath, int subpackIndex) const;
141
142 MCAPI ::std::vector<::Bedrock::Resources::PreloadedPathHandle>
143 preloadPath(::Core::Path const& packRelativePath, int subpackIndex, bool) const;
144
145#ifdef LL_PLAT_C
146 MCAPI void regenerateAssetSet();
147
148 MCAPI void resumeFallbackCache();
149#endif
150
151 MCAPI void setLocale(::std::string const& code);
152
153#ifdef LL_PLAT_C
154 MCAPI void suspendFallbackCache();
155#endif
156 // NOLINTEND
157
158public:
159 // static variables
160 // NOLINTBEGIN
161 MCAPI static ::Core::PathBuffer<::std::string> const& RESOURCE_PACK_BUG_ICON_PATH();
162
163 MCAPI static ::Core::PathBuffer<::std::string> const& RESOURCE_PACK_ICON_PATH();
164 // NOLINTEND
165
166public:
167 // constructor thunks
168 // NOLINTBEGIN
169 MCAPI void* $ctor(::I18n& loc, ::gsl::not_null<::std::shared_ptr<::Pack>> pack);
170 // NOLINTEND
171};
Definition PreloadedPathHandle.h:16
Definition PathView.h:19
Definition Path.h:11
Definition I18n.h:19
Definition Value.h:16
Definition PackAccessStrategy.h:25
Definition Pack.h:28
Definition BehaviorPackContents.h:5
Definition ResourcePackContents.h:5
Definition ResourcePack.h:33
Definition StreamableAssetSource.h:5
Definition SubpackInfo.h:5
Definition code.h:5