UseCooldownHelper
com.jsmacrosce.jsmacros.client.api.helper.inventory.UseCooldownHelper
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