46class ItemRegistry :
public ::std::enable_shared_from_this<::ItemRegistry> {
62 ::ll::TypedStorage<8, 48, ::HashedString> currentName;
63 ::ll::TypedStorage<8, 32, ::BaseGameVersion> sinceVersion;
83 ::ll::TypedStorage<8, 8, uint64> aliasName;
84 ::ll::TypedStorage<8, 32, ::BaseGameVersion> sinceVersion;
92 ::ll::TypedStorage<8, 272, ::Bedrock::Resources::MinecraftDocumentInput> mDocumentInput;
93 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::PackLoadContext>> mPackLoadContext;
94 ::ll::TypedStorage<8, 32, ::std::string> mLoadedPackName;
95 ::ll::TypedStorage<1, 1, bool> mIsComponentBased;
115 ::ll::TypedStorage<8, 336, ::std::optional<::ItemRegistry::LoadedItemAsset>> mLoadedItemAsset;
116 ::ll::TypedStorage<8, 32, ::std::string> mError;
136 ::ll::TypedStorage<8, 16, ::std::string_view> mItemIdentifier;
137 ::ll::TypedStorage<8, 32, ::std::string> mParsedNamespace;
138 ::ll::TypedStorage<8, 32, ::std::string> mParsedName;
139 ::ll::TypedStorage<4, 4, int> mAux;
155 using CreativeItemsServerInitCallbackSignature = void(
170 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::cereal::ReflectionCtx>>> mCerealContext;
171 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::LinkedAssetValidator>> mValidator;
172 ::ll::TypedStorage<8, 24, ::std::vector<::SharedPtr<::Item>>> mItemRegistry;
173 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::WeakPtr<::Item>>> mIdToItemMap;
174 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::WeakPtr<::Item>>> mNameToItemMap;
175 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::WeakPtr<::Item>>> mTileNamespaceToItemMap;
176 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::WeakPtr<::Item>>> mTileItemNameToItemMap;
177 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::ItemRegistry::ItemAlias>> mItemAliasLookupMap;
178 ::ll::TypedStorage<8, 64, ::std::unordered_map<uint64, ::ItemRegistry::ItemHashAlias>> mReverseAliasLookupMap;
179 ::ll::TypedStorage<8, 64, ::std::unordered_map<uint64, ::ItemRegistry::ItemHashAlias>>
180 mReverseFullNameAliasLookupMap;
181 ::ll::TypedStorage<8, 64, ::std::unordered_map<::HashedString, ::ItemRegistryComplexAlias>> mComplexAliasLookupMap;
182 ::ll::TypedStorage<8, 64, ::std::unordered_map<short, ::HashedString>> mLegacyIDToNameMap;
183 ::ll::TypedStorage<2, 2, short> mMaxItemID;
184 ::ll::TypedStorage<8, 24, ::std::vector<::HashedString>> mAttachableDefinitions;
185 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ItemTag, ::std::unordered_set<::Item const*>>> mTagToItemsMap;
186 ::ll::TypedStorage<8, 64, ::std::unordered_set<::Item const*>
const> mEmptyItemSet;
187 ::ll::TypedStorage<1, 1, bool> mServerInitializingCreativeItems;
188 ::ll::TypedStorage<1, 1, bool> mIsInitialized;
189 ::ll::TypedStorage<8, 64, ::std::function<void(
::ItemRegistryRef)>> mExtraItemInitCallback;
194 mFinishedInitServerPublisher;
195 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::std::atomic<int>>> mCanUpdateTags;
196 ::ll::TypedStorage<8, 24, ::std::vector<::SharedPtr<::Item>>> mDeadItemRegistry;
197 ::ll::TypedStorage<8, 32, ::BaseGameVersion> mWorldBaseGameVersion;
198 ::ll::TypedStorage<1, 1, bool> mCheckForItemWorldCompatibility;
199 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::Bedrock::Threading::Mutex>> mCompatibilityCheckMutex;
200 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::CreativeItemRegistry>> mCreativeItemRegistry;
206 MCAPI ItemRegistry();
208 MCAPI
void _initServerData(
209 ::std::vector<::ItemRegistry::LoadedItemAsset>
const& allItemAssets,
214 MCAPI
bool _shouldIgnoreEduItem(::std::string_view itemName);
216 MCAPI ::WeakPtr<::Item> _tryCreateItem(
220 bool componentBasedItem,
224 MCAPI ::ItemRegistryRef::LoadedItem
229 MCAPI
void clearItemAndCreativeItemRegistry();
232 MCAPI
void digestServerItemComponents(::std::vector<::ItemData>
const& items);
234 MCAPI
void findAllAttachableDefinitions();
237 MCAPI
void finishedRegistration();
239 MCAPI ::std::vector<::std::reference_wrapper<::HashedString const>>
const&
244 MCAPI ::WeakPtr<::Item> getItem(
short id);
246 MCAPI ::std::pair<::HashedString, int> getNameFromAlias(
::HashedString const& name,
int aux)
const;
249 MCAPI
void initClient(
250 ::std::vector<::ItemData>
const& serverItemData,
255 MCAPI
void initClientData(
258 ::std::optional<::ItemIconInfo> (*iconFactory)(::std::string
const&,
int)
262 MCAPI
void initCreativeItemsServer(
268 ::std::function<
void(
281 MCAPI
void initServer(
291 MCAPI ::WeakPtr<::Item> lookupByName(
::HashedString const& inString)
const;
293 MCAPI ::WeakPtr<::Item> lookupByName(
int& inOutItemAux, ::std::string_view inString)
const;
295 MCAPI ::WeakPtr<::Item> lookupByName(
int& outItemId,
int& inOutItemAux, ::std::string_view inString)
const;
297 MCAPI ::WeakPtr<::Item> lookupByNameNoAlias(::std::string_view inString)
const;
299 MCAPI ::WeakPtr<::Item> lookupByNameNoParsing(
int& inOutItemAux,
::HashedString const& fullName)
const;
301 MCFOLD ::WeakPtr<::Item> lookupByVanillaName(
::HashedString const& inString)
const;
304 MCAPI
void matchServerItemIds(::std::vector<::ItemData>
const& serverItemData);
307 MCAPI
void onLevelInit(
316 MCAPI ::WeakPtr<::Item>
321 MCAPI
void registerLegacyID(
::HashedString const& name,
short id);
323 MCAPI
void registerLegacyMapping(
329 MCAPI
void registerValidatorIdentifier(::std::string
const& str);
331 MCAPI uint64 remapToFullLegacyNameByHash(uint64 newHash);
333 MCAPI uint64 remapToLegacyNameByHash(uint64 newHash);
336 MCAPI
void setItemId(
::HashedString const& itemName,
short itemId,
bool isComponentBased);
339 MCAPI
void shutdown();
343 MCAPI ::std::vector<::std::string> validateServerItemComponents(::std::vector<::ItemData>
const& items);
345 MCAPI ~ItemRegistry();
351 MCAPI static ::std::vector<::ItemRegistry::LoadedItemAsset> _loadAllItemAssets(
358 MCAPI static ::ItemRegistry::ItemLoadResult _tryLoadItemAsset(
359 ::std::string_view jsonData,
360 ::std::shared_ptr<::PackLoadContext> packLoadContext,
363 ::std::string
const& packName
366 MCAPI static ::ItemRegistry::ParsedName _tryParseItemName(
367 ::rapidjson::GenericValue<
368 ::rapidjson::UTF8<char>,
369 ::rapidjson::MemoryPoolAllocator<::rapidjson::CrtAllocator>>
const& itemData
372 MCAPI
static short getBlockItemId(
::Block const& block);
374 MCAPI
static short getBlockItemId(
::BlockType const& block);
380 MCAPI static ::std::string_view
const& MINECRAFT_NAMESPACE();
Definition PackLoadContext.h:20
Definition ItemParseContext.h:13