LeviLamina
Loading...
Searching...
No Matches
ItemRegistry.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/common/SharedPtr.h"
7#include "mc/common/WeakPtr.h"
8#include "mc/deps/core/utility/NonOwnerPointer.h"
9#include "mc/deps/core/utility/pub_sub/Publisher.h"
10#include "mc/deps/game_refs/WeakRef.h"
11#include "mc/resources/BaseGameVersion.h"
12
13// auto generated forward declare list
14// clang-format off
18class Experiments;
19class HashedString;
22class Item;
23class ItemRegistryRef;
24class LevelData;
27struct ItemData;
28struct ItemParseContext;
30struct ItemTag;
31namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
32namespace Bedrock::Threading { class Mutex; }
33namespace Core { class Path; }
34namespace cereal { struct ReflectionCtx; }
35// clang-format on
36
37class ItemRegistry : public ::std::enable_shared_from_this<::ItemRegistry> {
38public:
39 // ItemRegistry inner types declare
40 // clang-format off
41 struct ItemAlias;
42 struct ItemHashAlias;
43 struct ItemLoadResult;
44 struct LoadedItemAsset;
45 // clang-format on
46
47 // ItemRegistry inner types define
48 using ItemRegistryMap = ::std::vector<::SharedPtr<::Item>>;
49
51 public:
52 // member variables
53 // NOLINTBEGIN
57 // NOLINTEND
58
59 public:
60 // prevent constructor by default
61 LoadedItemAsset& operator=(LoadedItemAsset const&);
64
65 public:
66 // member functions
67 // NOLINTBEGIN
69 // NOLINTEND
70
71 public:
72 // destructor thunk
73 // NOLINTBEGIN
74 MCNAPI void $dtor();
75 // NOLINTEND
76 };
77
78 using CreativeItemsServerInitCallbackSignature = void(
82 ::BaseGameVersion const&,
83 ::Experiments const&,
86 );
87
88 struct ItemAlias {
89 public:
90 // member variables
91 // NOLINTBEGIN
94 // NOLINTEND
95
96 public:
97 // prevent constructor by default
98 ItemAlias& operator=(ItemAlias const&);
99 ItemAlias(ItemAlias const&);
100 ItemAlias();
101
102 public:
103 // member functions
104 // NOLINTBEGIN
105 MCNAPI ~ItemAlias();
106 // NOLINTEND
107
108 public:
109 // destructor thunk
110 // NOLINTBEGIN
111 MCNAPI void $dtor();
112 // NOLINTEND
113 };
114
116 public:
117 // member variables
118 // NOLINTBEGIN
121 // NOLINTEND
122
123 public:
124 // prevent constructor by default
125 ItemHashAlias& operator=(ItemHashAlias const&);
128
129 public:
130 // member functions
131 // NOLINTBEGIN
133 // NOLINTEND
134
135 public:
136 // destructor thunk
137 // NOLINTBEGIN
138 MCNAPI void $dtor();
139 // NOLINTEND
140 };
141
143 public:
144 // member variables
145 // NOLINTBEGIN
148 // NOLINTEND
149
150 public:
151 // prevent constructor by default
152 ItemLoadResult& operator=(ItemLoadResult const&);
155
156 public:
157 // member functions
158 // NOLINTBEGIN
160 // NOLINTEND
161
162 public:
163 // destructor thunk
164 // NOLINTBEGIN
165 MCNAPI void $dtor();
166 // NOLINTEND
167 };
168
169public:
170 // member variables
171 // NOLINTBEGIN
172 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::cereal::ReflectionCtx>>> mCerealContext;
173 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::LinkedAssetValidator>> mValidator;
174 ::ll::TypedStorage<8, 24, ::std::vector<::SharedPtr<::Item>>> mItemRegistry;
175 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::WeakPtr<::Item>>> mIdToItemMap;
176 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::WeakPtr<::Item>>> mNameToItemMap;
177 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::WeakPtr<::Item>>> mTileNamespaceToItemMap;
178 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::WeakPtr<::Item>>> mTileItemNameToItemMap;
179 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::ItemRegistry::ItemAlias>> mItemAliasLookupMap;
180 ::ll::TypedStorage<8, 64, ::std::unordered_map<uint64, ::ItemRegistry::ItemHashAlias>> mReverseAliasLookupMap;
181 ::ll::TypedStorage<8, 64, ::std::unordered_map<uint64, ::ItemRegistry::ItemHashAlias>>
182 mReverseFullNameAliasLookupMap;
183 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::ItemRegistryComplexAlias>> mComplexAliasLookupMap;
184 ::ll::TypedStorage<8, 64, ::std::unordered_map<short, ::HashedString>> mLegacyIDToNameMap;
185 ::ll::TypedStorage<2, 2, short> mMaxItemID;
186 ::ll::TypedStorage<8, 24, ::std::vector<::HashedString>> mAttachableDefinitions;
187 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ItemTag, ::std::unordered_set<::Item const*>>> mTagToItemsMap;
188 ::ll::TypedStorage<8, 64, ::std::unordered_set<::Item const*> const> mEmptyItemSet;
189 ::ll::TypedStorage<1, 1, bool> mServerInitializingCreativeItems;
190 ::ll::TypedStorage<1, 1, bool> mIsInitialized;
191 ::ll::TypedStorage<8, 64, ::std::function<void(::ItemRegistryRef)>> mExtraItemInitCallback;
192 ::ll::TypedStorage<
193 8,
194 8,
196 mFinishedInitServerPublisher;
197 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::std::atomic<int>>> mCanUpdateTags;
198 ::ll::TypedStorage<8, 24, ::std::vector<::SharedPtr<::Item>>> mDeadItemRegistry;
199 ::ll::TypedStorage<8, 32, ::BaseGameVersion> mWorldBaseGameVersion;
200 ::ll::TypedStorage<1, 1, bool> mCheckForItemWorldCompatibility;
201 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::Bedrock::Threading::Mutex>> mCompatibilityCheckMutex;
202 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CreativeItemRegistry>> mCreativeItemRegistry;
203 // NOLINTEND
204
205public:
206 // member functions
207 // NOLINTBEGIN
208 MCAPI ItemRegistry();
209
210 MCAPI void
211 _loadItemDefinition(::ItemRegistry::LoadedItemAsset const& loadedItemAsset, ::ItemParseContext& parseContext);
212
213 MCAPI void addItemToTagMap(::Item const& item);
214
215 MCAPI void alterAvailableCreativeItems(::ActorInfoRegistry* registry, ::LevelData& levelData);
216
217 MCAPI void clearItemAndCreativeItemRegistry();
218
219 MCAPI void finishedRegistration();
220
221 MCAPI ::std::vector<::std::reference_wrapper<::HashedString const>> const&
222 getComplexAliasSplitNames(::HashedString const& oldName) const;
223
224 MCAPI ::WeakPtr<::Item> getItem(short id);
225
226 MCAPI ::std::pair<::HashedString, int> getNameFromAlias(::HashedString const& name, int aux) const;
227
228 MCAPI ::HashedString getNameFromLegacyID(short id);
229
230 MCAPI void initCreativeItemsServer(
231 ::BlockDefinitionGroup const& blockDefinitionGroup,
232 ::Experiments const& experiments,
233 ::ResourcePackManager const& resourcePackManager,
234 ::std::function<void(
238 ::BaseGameVersion const&,
239 ::Experiments const&,
242 )> registerCallback
243 );
244
245 MCAPI void initServer(
246 ::Experiments const& experiments,
247 ::BaseGameVersion const& baseGameVersion,
250 );
251
252 MCAPI ::WeakPtr<::Item> lookupByName(int& inOutItemAux, ::std::string_view inString) const;
253
254 MCAPI ::WeakPtr<::Item> lookupByNameNoAlias(::std::string_view inString) const;
255
256 MCAPI ::WeakPtr<::Item> lookupByNameNoParsing(int& inOutItemAux, ::HashedString const& fullName) const;
257
258 MCAPI void onLevelInit(::WeakRef<::IDynamicContainerSerialization> containerSerialization);
259
260 MCAPI void
261 registerAlias(::HashedString const& alias, ::HashedString const& name, ::BaseGameVersion const& fromVersion);
262
263 MCAPI ::WeakPtr<::Item>
264 registerComplexAlias(::HashedString const& alias, ::ItemRegistryComplexAlias const& complexAlias);
265
266 MCAPI void registerItem(::SharedPtr<::Item> item);
267
268 MCAPI void registerLegacyID(::HashedString const& name, short id);
269
270 MCAPI void registerLegacyMapping(
271 ::HashedString const& alias,
272 ::HashedString const& name,
273 ::BaseGameVersion const& fromVersion
274 );
275
276 MCAPI void setCheckForItemWorldCompatibility(bool value);
277
278 MCAPI void unregisterItem(::HashedString const& itemName);
279
280 MCAPI ::std::vector<::std::string> validateServerItemComponents(::std::vector<::ItemData> const& items);
281
282 MCAPI ~ItemRegistry();
283 // NOLINTEND
284
285public:
286 // static functions
287 // NOLINTBEGIN
288 MCAPI static ::std::vector<::ItemRegistry::LoadedItemAsset> _loadAllItemAssets(
289 ::ResourcePackManager const& resourcePackManager,
290 ::Experiments const& experiments,
293 );
294
295 MCAPI static ::ItemRegistry::ItemLoadResult _tryLoadItemAsset(
296 ::std::string jsonData,
297 ::std::shared_ptr<::IPackLoadContext> packLoadContext,
298 ::Core::Path const& filenameWithExtension,
300 );
301 // NOLINTEND
302
303public:
304 // static variables
305 // NOLINTBEGIN
306 MCAPI static ::std::string_view const& MINECRAFT_NAMESPACE();
307 // NOLINTEND
308
309public:
310 // constructor thunks
311 // NOLINTBEGIN
312 MCAPI void* $ctor();
313 // NOLINTEND
314
315public:
316 // destructor thunk
317 // NOLINTBEGIN
318 MCAPI void $dtor();
319 // NOLINTEND
320};
Definition ActorInfoRegistry.h:10
Definition BaseGameVersion.h:8
Definition NonOwnerPointer.h:9
Definition Publisher.h:8
Definition BlockDefinitionGroup.h:34
Definition Path.h:17
Definition CreativeItemRegistry.h:20
Definition Experiments.h:14
Definition HashedString.h:5
Definition IDynamicContainerSerialization.h:12
Definition IPackLoadContext.h:20
Definition ItemRegistryRef.h:31
Definition ItemRegistry.h:37
Definition Item.h:65
Definition LevelData.h:49
Definition LinkedAssetValidator.h:8
Definition Path.h:16
Definition ResourcePackManager.h:23
Definition SharedPtr.h:10
Definition WeakRef.h:8
Definition ItemData.h:15
Definition ItemParseContext.h:5
Definition ItemRegistryComplexAlias.h:5
Definition ItemRegistry.h:88
Definition ItemRegistry.h:115
Definition ItemRegistry.h:142
Definition ItemRegistry.h:50
Definition ItemTag.h:8
Definition ReflectionCtx.h:11
Definition ctx.h:5
Definition Alias.h:14