Class: ItemComponentRegistry
componentBeta
提供为物品注册自定义组件的功能。
Provides the functionality for registering custom components for items.
Methods
registerCustomComponent()
registerCustomComponent(
name,itemCustomComponent):void
Early Execution Beta
Parameters
name
string
表示该自定义组件的 ID,必须包含命名空间。该 ID 可在物品 JSON 配置的 'minecraft:custom_components' 物品组件下指定。
itemCustomComponent
当使用此自定义组件 ID 的物品上发生对应事件时,将被调用的事件函数集合。
Returns
void
Remarks
注册一个可在物品 JSON 配置中使用的物品自定义组件。
Registers an item custom component that can be used in item JSON configuration.
Throws
This function can throw errors.
CustomComponentInvalidRegistryError
ItemCustomComponentAlreadyRegisteredError
ItemCustomComponentReloadNewComponentError
ItemCustomComponentReloadNewEventError
ItemCustomComponentReloadVersionError
