Skip to content

UseCooldownHelper ​

com.jsmacrosce.jsmacros.client.api.helper.inventory.UseCooldownHelper

Since2.3.0

Reads the cooldown configured on a stack and the custom group of items that share it.

js
const stack = Player.getPlayer()?.getMainHand();  
if (stack != null) {
 const cooldown = stack.getComponents().getUseCooldown();  
 if (cooldown !== null) Chat.log(`${cooldown.getGroupId() ?? stack.getItemId()}: ${cooldown.getDurationTicks()} ticks`);  
}

Methods ​

getDurationSeconds ​

getDurationSeconds(): float#
Returns: the configured cooldown duration in seconds

getDurationTicks ​

getDurationTicks(): int#
Returns: the configured duration after Minecraft converts it to ticks

getGroupId ​

getGroupId(): String#
Returns: the configured group ID, or null if Minecraft uses the item's ID