类 ItemCooldownComponent实验性

表示物品使用冷却组件。当出现在物品上时,表示该物品被实体使用后会有冷却效果。 注意,若使用后不会进入冷却,原版物品会获取到没有实际作用的该组件。

When present on an item, this item has a cooldown effect when used by entities.

层级 (查看完整内容)

属性

cooldownCategory: string

表示物品的冷却类别。

Represents the cooldown category that this item is associated with.

This property can throw when used.

cooldownTicks: number

物品冷却所需的时间,单位为刻。

Amount of time, in ticks, it will take this item to cooldown.

This property can throw when used.

typeId: string

Identifier of the component.

componentId: "minecraft:cooldown" = 'minecraft:cooldown'

方法

  • 实验性

    参数

    • cooldownCategory: string

      The cooldown category that might be associated with this item.

    返回 boolean

    True if the item is the given cooldown category.

    Will return true if the item is the cooldown category passed in and false otherwise.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    This function can throw errors.

  • 实验性

    参数

    • cooldownCategory: string

      The cooldown category that might be associated with this item.

    返回 boolean

    True if the item is the given cooldown category.

    Will return true if the item is the cooldown category passed in and false otherwise.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    This function can throw errors.

  • 实验性

    返回 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.

  • 实验性

    参数

    返回 void

    开始物品的冷却周期。 如果物品已在冷却中,将重新开始冷却。

    Starts a new cooldown period for this item.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    This function can throw errors.