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/pub_sub/Publisher.h"
9#include "mc/deps/game_refs/WeakRef.h"
10
11// auto generated forward declare list
12// clang-format off
14class BaseGameVersion;
17class Experiments;
18class HashedString;
21class Item;
22class ItemRegistryRef;
23class LevelData;
25struct ItemData;
26struct ItemParseContext;
28struct ItemTag;
29namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
30namespace Bedrock::Threading { class Mutex; }
31namespace Core { class Path; }
32namespace cereal { struct ReflectionCtx; }
33// clang-format on
34
35class ItemRegistry : public ::std::enable_shared_from_this<::ItemRegistry> {
36public:
37 // ItemRegistry inner types declare
38 // clang-format off
39 struct ItemAlias;
40 struct ItemHashAlias;
41 struct ItemLoadResult;
42 struct LoadedItemAsset;
43 // clang-format on
44
45 // ItemRegistry inner types define
46 using ItemRegistryMap = ::std::vector<::SharedPtr<::Item>>;
47
49 public:
50 // member variables
51 // NOLINTBEGIN
55 // NOLINTEND
56
57 public:
58 // prevent constructor by default
59 LoadedItemAsset& operator=(LoadedItemAsset const&);
62
63 public:
64 // member functions
65 // NOLINTBEGIN
66 MCAPI ~LoadedItemAsset();
67 // NOLINTEND
68
69 public:
70 // destructor thunk
71 // NOLINTBEGIN
72 MCAPI void $dtor();
73 // NOLINTEND
74 };
75
76 using CreativeItemsServerInitCallbackSignature =
78
79 struct ItemAlias {
80 public:
81 // member variables
82 // NOLINTBEGIN
85 // NOLINTEND
86
87 public:
88 // prevent constructor by default
89 ItemAlias& operator=(ItemAlias const&);
90 ItemAlias(ItemAlias const&);
91 ItemAlias();
92
93 public:
94 // member functions
95 // NOLINTBEGIN
96 MCAPI ~ItemAlias();
97 // NOLINTEND
98
99 public:
100 // destructor thunk
101 // NOLINTBEGIN
102 MCAPI void $dtor();
103 // NOLINTEND
104 };
105
107 public:
108 // member variables
109 // NOLINTBEGIN
112 // NOLINTEND
113
114 public:
115 // prevent constructor by default
116 ItemHashAlias& operator=(ItemHashAlias const&);
119
120 public:
121 // member functions
122 // NOLINTBEGIN
123 MCAPI ItemHashAlias(uint64 nameHash, ::BaseGameVersion const& version);
124
125 MCAPI ::ItemRegistry::ItemHashAlias& operator=(::ItemRegistry::ItemHashAlias&&);
126
127 MCAPI ~ItemHashAlias();
128 // NOLINTEND
129
130 public:
131 // constructor thunks
132 // NOLINTBEGIN
133 MCAPI void* $ctor(uint64 nameHash, ::BaseGameVersion const& version);
134 // NOLINTEND
135
136 public:
137 // destructor thunk
138 // NOLINTBEGIN
139 MCFOLD void $dtor();
140 // NOLINTEND
141 };
142
144 public:
145 // member variables
146 // NOLINTBEGIN
149 // NOLINTEND
150
151 public:
152 // prevent constructor by default
153 ItemLoadResult& operator=(ItemLoadResult const&);
156
157 public:
158 // member functions
159 // NOLINTBEGIN
160 MCAPI ~ItemLoadResult();
161 // NOLINTEND
162
163 public:
164 // destructor thunk
165 // NOLINTBEGIN
166 MCAPI void $dtor();
167 // NOLINTEND
168 };
169
170public:
171 // member variables
172 // NOLINTBEGIN
173 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::cereal::ReflectionCtx>>> mCerealContext;
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<
236 registerCallback
237 );
238
239 MCAPI void
240 initServer(::Experiments const& experiments, ::BaseGameVersion const& baseGameVersion, ::ResourcePackManager* rpm);
241
242 MCAPI ::WeakPtr<::Item> lookupByName(int& inOutItemAux, ::std::string_view inString) const;
243
244 MCAPI ::WeakPtr<::Item> lookupByNameNoAlias(::std::string_view inString) const;
245
246 MCAPI ::WeakPtr<::Item> lookupByNameNoParsing(int& inOutItemAux, ::HashedString const& fullName) const;
247
248 MCAPI void onLevelInit(::WeakRef<::IDynamicContainerSerialization> containerSerialization);
249
250 MCAPI void
251 registerAlias(::HashedString const& alias, ::HashedString const& name, ::BaseGameVersion const& fromVersion);
252
253 MCAPI ::WeakPtr<::Item>
254 registerComplexAlias(::HashedString const& alias, ::ItemRegistryComplexAlias const& complexAlias);
255
256 MCAPI void registerItem(::SharedPtr<::Item> item);
257
258 MCAPI void registerLegacyID(::HashedString const& name, short id);
259
260 MCAPI void registerLegacyMapping(
261 ::HashedString const& alias,
262 ::HashedString const& name,
263 ::BaseGameVersion const& fromVersion
264 );
265
266 MCAPI void setCheckForItemWorldCompatibility(bool value);
267
268 MCAPI void unregisterItem(::HashedString const& itemName);
269
270 MCAPI ::std::vector<::std::string> validateServerItemComponents(::std::vector<::ItemData> const& items);
271
272 MCAPI ~ItemRegistry();
273 // NOLINTEND
274
275public:
276 // static functions
277 // NOLINTBEGIN
278 MCAPI static ::std::vector<::ItemRegistry::LoadedItemAsset> _loadAllItemAssets(
279 ::ResourcePackManager const& resourcePackManager,
280 ::Experiments const& experiments,
282 );
283
284 MCAPI static ::ItemRegistry::ItemLoadResult _tryLoadItemAsset(
285 ::std::string jsonData,
286 ::std::shared_ptr<::IPackLoadContext> packLoadContext,
287 ::Core::Path const& filenameWithExtension,
289 );
290 // NOLINTEND
291
292public:
293 // static variables
294 // NOLINTBEGIN
295 MCAPI static ::std::string_view const& MINECRAFT_NAMESPACE();
296 // NOLINTEND
297
298public:
299 // constructor thunks
300 // NOLINTBEGIN
301 MCAPI void* $ctor();
302 // NOLINTEND
303
304public:
305 // destructor thunk
306 // NOLINTBEGIN
307 MCAPI void $dtor();
308 // NOLINTEND
309};
Definition ActorInfoRegistry.h:10
Definition BaseGameVersion.h:13
Definition Publisher.h:8
Definition BlockDefinitionGroup.h:33
Definition Path.h:15
Definition CreativeItemRegistry.h:20
Definition Experiments.h:14
Definition HashedString.h:5
Definition IDynamicContainerSerialization.h:12
Definition IPackLoadContext.h:17
Definition ItemRegistryRef.h:29
Definition ItemRegistry.h:35
Definition Item.h:65
Definition LevelData.h:48
Definition Path.h:16
Definition ResourcePackManager.h:24
Definition SharedPtr.h:10
Definition WeakRef.h:8
Definition ItemData.h:15
Definition ItemParseContext.h:5
Definition ItemRegistryComplexAlias.h:5
Definition ItemRegistry.h:79
Definition ItemRegistry.h:106
Definition ItemRegistry.h:143
Definition ItemRegistry.h:48
Definition ItemTag.h:8
Definition ReflectionCtx.h:11
Definition ctx.h:5
Definition Alias.h:14