Class in @minecraft/server
Extends ItemComponent
An item’s cooldown: once used, items of its category wait before they can be used again.
import { ItemCooldownComponent } from '@minecraft/server';Example
Section titled “Example”import { ItemStack, type ItemCooldownComponent } from '@minecraft/server';
const item = new ItemStack('minecraft:diamond_sword');const component: ItemCooldownComponent | undefined = item.getComponent('minecraft:cooldown');if (component) { console.log(item.typeId, component.cooldownCategory);}import { ItemStack } from '@minecraft/server';
const item = new ItemStack('minecraft:diamond_sword');const component = item.getComponent('minecraft:cooldown');if (component) { console.log(item.typeId, component.cooldownCategory);}Properties
Section titled “Properties”componentId
Section titled “componentId”static read-only
static readonly componentId = "minecraft:cooldown";cooldownCategory
Section titled “cooldownCategory”read-only
readonly cooldownCategory: string;cooldownTicks
Section titled “cooldownTicks”read-only
readonly cooldownTicks: number;Ticks a use makes the category wait.
Methods
Section titled “Methods”getCooldownTicksRemaining
Section titled “getCooldownTicksRemaining”getCooldownTicksRemaining(player: Player): number;Ticks the player still waits on this category, 0 for none.
Parameters
playerPlayer
Returns
numberTypes
isCooldownCategory
Section titled “isCooldownCategory”isCooldownCategory(cooldownCategory: string): boolean;Parameters
cooldownCategorystring
Returns
booleanstartCooldown
Section titled “startCooldown”startCooldown(player: Player): void;Starts the cooldown for a player, greying the category’s items out on their screen.
Parameters
playerPlayer
Types
Used by
Section titled “Used by”ItemComponentTypeMap.cooldown, ItemComponentTypeMap.minecraft:cooldown
Inherited
Section titled “Inherited”From ItemComponent: typeId, isValid