ItemCooldownComponent Class

Extends

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

Properties

cooldownCategory

read-only cooldownCategory: string;

Represents the cooldown category that this item is associated with.

Type: string

Warning

This property can throw errors when used.

cooldownTicks

read-only cooldownTicks: number;

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

Type: number

Warning

This property can throw errors when used.

Methods

getCooldownTicksRemaining

getCooldownTicksRemaining(player: Player): number

Parameters

Returns number

Important

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

Warning

This function can throw errors.

isCooldownCategory

isCooldownCategory(cooldownCategory: string): boolean

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

Parameters

  • cooldownCategory: string

    The cooldown category that might be associated with this item.

Returns boolean - True if the item is the given cooldown category.

Important

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

Warning

This function can throw errors.

startCooldown

startCooldown(player: Player): void

Starts a new cooldown period for this item.

Parameters

Important

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

Warning

This function can throw errors.

Constants

componentId

static read-only componentId = "minecraft:cooldown";

Type: string