Class ItemDurabilityComponentBeta

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

Constructors

Properties

damage: number

Remarks

Returns the current damage level of this particular item.

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

maxDurability: number

Remarks

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

Throws

This property can throw when used.

typeId: string
componentId: "minecraft:durability" = 'minecraft:durability'

Remarks

Identifier of this component. Should always be 'minecraft:durability'.

Methods

  • Parameters

    • Optional unbreaking: number

      Unbreaking factor to consider in factoring the damage chance. Incoming unbreaking parameter must be greater than 0.

    Returns number

    Remarks

    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.

    Throws

    This function can throw errors.

  • Returns NumberRange

    Remarks

    A range of numbers that describes the chance of the item losing durability.

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

    Throws

    This function can throw errors.