Skip to main content

Class: ItemComponentRegistry

Provides the functionality for registering custom components for items.

Constructors

new ItemComponentRegistry()

private new ItemComponentRegistry(): ItemComponentRegistry

Returns

ItemComponentRegistry

Methods

registerCustomComponent()

registerCustomComponent(name, itemCustomComponent): void

Parameters

ParameterTypeDescription
namestringThe id that represents this custom component. Must have a
namespace. This id can be specified in a item's JSON
configuration under the 'minecraft:custom_components' item
component.
itemCustomComponentItemCustomComponentThe collection of event functions that will be called when
the event occurs on an item using this custom component id.

Returns

void

Remarks

Registers an item custom component that can be used in item JSON configuration.

Throws

This function can throw errors.

ItemCustomComponentAlreadyRegisteredError

ItemCustomComponentNameError

ItemCustomComponentReloadNewComponentError

ItemCustomComponentReloadNewEventError

ItemCustomComponentReloadVersionError