@bedrock-oss/bedrock-boost
    Preparing search index...

    Class ItemUtils

    Index

    Constructors

    Methods

    • Consumes durability from the player's selected item.

      Parameters

      • player: Player

        The player whose item durability will be consumed.

      • Optionaloptions: ConsumeDurabilityOptions

        The options for consuming durability.

        • OptionalbreakSound?: string

          Whether to suppress playing a sound when item breaks. Defaults to "random.break". If set to an empty string, no sound will be played.

        • OptionalignoreEnchantments?: boolean

          Whether to ignore enchantments when consuming durability.

        • Optionalslot?: EquipmentSlot

          The slot to consume durability from. Defaults to the player's main hand.

        • Optionalvalue?: number

          The amount of durability to consume. Defaults to 1.

      Returns boolean

      True if the durability was consumed, false otherwise.

      Return value false does not always mean that the function failed. It can also mean that the item was not damaged due to unbreaking enchantment.

    • Returns the chance to consume durability from item based on the unbreaking level.

      Parameters

      • unbreakingLevel: number

        The unbreaking level of the item.

      Returns number

      The chance to consume durability from item based on the unbreaking level.