{
"format_version": "1.20.50",
"minecraft:item": {
"description": {
"identifier": "cosmos:asteroid_annihilator",
"menu_category": {
"category": "equipment",
"group": "itemGroup.name.sword"
}
},
"components": {
"minecraft:max_stack_size": 1,
"minecraft:icon": "asteroid_annihilator",
"minecraft:damage": 9,
"minecraft:can_destroy_in_creative": false,
"minecraft:hand_equipped": true,
"minecraft:enchantable": {
"slot": "sword",
"value": 14
},
"minecraft:durability": {
"max_durability": 2043
},
"minecraft:cooldown": {
"category": "wind_charge",
"duration": 0.5
}
}
}
}
#Cooldown not working resolved
1 messages · Page 1 of 1 (latest)
i have the cooldown component
but tvery time i use the item
it doesnt do the cooldown
cooldowns are triggered when using items that have a component that makes them usable, such as these:
- shooter
- throwable
- food
- bundle_interaction
if you haven't applied a component that makes the item usable, you'll have to handle the triggering of the cooldown yourself in scripts
also you probably shouldn't be using wind_charge as the cooldown category (unless you want your item to share its cooldown with wind charges)
something like "category": "cosmos:asteroid_annihilator" would be better
thanks
@tidal urchinhow do i make the item just useable
like i can js interact with it
its not a shooter or anything like that
because ms learn is kinda cheeks at explaining this stuff
There's no way to make an item generically usable
You could make a custom component that handles the cooldown for the item
i think ill just do it in script api
how do i do that?
the event you're using to trigger the content log should give you access to the ItemStack being used
you can then use itemStack.getComponent("minecraft:cooldown").startCooldown(player)
yes but how do i active the cooldown upon the event firing
oh ok
thanks
@tidal urchingoat
btw I think the itemuse event will trigger even if the item is in cooldown so you might also have to check that the item is not currently in cooldown
ItemStartUse doesn't so I'm not sure
Which version is it for?
You can use a custom components and do the component event onUse to say that this will do this when used. You can then do something like itemStack.getComponent(ItemCooldownComponent.componentId).startCooldown(player);. This will also make it so it will only fire when the cooldown is up, so it won't fire before.
Cooldown not working resolved