Class: ItemCooldownComponent
When present on an item, this item has a cooldown effect when used by entities.
Extends
Constructors
new ItemCooldownComponent()
private
new ItemCooldownComponent():ItemCooldownComponent
Returns
Overrides
Properties
cooldownCategory
readonly
cooldownCategory:string
Remarks
Represents the cooldown category that this item is associated with.
Throws
This property can throw when used.
cooldownTicks
readonly
cooldownTicks:number
Remarks
Amount of time, in ticks, it will take this item to cooldown.
Throws
This property can throw when used.
typeId
readonly
typeId:string
Remarks
Identifier of the component.
Inherited from
componentId
static
readonly
componentId:"minecraft:cooldown"
='minecraft:cooldown'
Methods
getCooldownTicksRemaining()
getCooldownTicksRemaining(
player
):number
Parameters
Parameter | Type |
---|---|
player | Player |
Returns
number
Remarks
This function can't be called in read-only mode.
Throws
This function can throw errors.
isCooldownCategory()
isCooldownCategory(
cooldownCategory
):boolean
Parameters
Parameter | Type | Description |
---|---|---|
cooldownCategory | string | The cooldown category that might be associated with this item. |
Returns
boolean
True if the item is the given cooldown category.
Remarks
Will return true if the item is the cooldown category passed in and false otherwise.
This function can't be called in read-only mode.
Throws
This function can throw errors.
isValid()
isValid():
boolean
Returns
boolean
Whether the component is valid.
Inherited from
Remarks
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.
startCooldown()
startCooldown(
player
):void
Parameters
Parameter | Type |
---|---|
player | Player |
Returns
void
Remarks
Starts a new cooldown period for this item.
This function can't be called in read-only mode.
Throws
This function can throw errors.