When present on an item, this item can take damage in the process of being used. Note that this component only applies to data-driven items.

Hierarchy (View Summary)

Properties

damage: number

Returns the current damage level of this particular item.

This property can't be edited in read-only mode.

maxDurability: number

Represents the amount of damage that this item can take before breaking.

This property can throw when used.

typeId: string

Identifier of the component.

componentId: "minecraft:durability" = 'minecraft:durability'

Methods

  • Beta

    Parameters

    • OptionalunbreakingEnchantmentLevel: number

    Returns number

    Returns the maximum chance that this item would be damaged using the damageRange property, given an unbreaking level.

    This function can't be called in read-only mode.

    This function can throw errors.

  • Beta

    Returns NumberRange

    Returns the min and max variables used by the damage chance formula: chance = (min + ((max - min) / (unbreaking + 1)))

    This function can't be called in read-only mode.

    This function can throw errors.

  • Beta

    Returns boolean

    Whether the component is valid.

    Returns whether the component is valid. A component is considered valid if its owner is valid, in addition to any addition to any additional validation required by the component.