Hi! I'm in love with the new components and the ability to add cooldowns and custom consume times and animations to items, and I reeeeeally want to use these cooldowns on items. Unfortunately, the cooldown only applies when the item is fully consumed, which also kind of destroys the item (or converts it to a different item). Is there any way to apply this cooldown component without getting rid of the item? Maybe a clever way to get the item back immediately after? What ideas can y'all come up with? :3
#Right-click detection with cooldown
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
Someone will come and help soon!
💬 While you wait, take this time to provide more context and details.
🙇 If nobody has answered you by <t:1730380973:t>, feel free to use the Summon Helpers button to ping our helper team.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
Hmmmm
I was thinking that, but is the cooldown modifiable without making it able to be eaten?
And if it is... could I do that to other items too?
only goat horns
though you can differentiate between different goat horns because:
- you can set individual cooldown groups
- you can detect different goat horns based on their item_model with a predicate
an 'instrument' registry entry is like a jukebox, you can specify the duration
Wair and can u change the cooldown?
easily
Hmmmm... so, how would I do this?
And is there any way with an ordinary item or weapon?
it has to be based on the goat horn, unfortunately
I was thinking of a method, but it may not work
Would it be possible to use the "use_remainder" component to give you a temporary item that gets detected and replaced if held?
using 'inventory_changed'?
technically it works
but I think it has limitations, like you can't keep renames
Like, could I make an advancement to detect it?
That would probably be fine
Actually wait
umm
hmmm
wait, I don't know if it can detect which slot to clear
If the item can't stack, won't it just be in the slot it was previously on?
it could be working that way, but idk if it works for offhand
also test when there are items on the ground and your inventory is full
I can't test rn, can u?
I'm outside too
ok umm bad news
It doesn't work lol 😭
Anyways, about the goat horns
Do I change the cooldown component? Or something else?
the cooldown's number component doesn't work on goat horns, but the cooldown group does, so it should be defined
the real cooldown is controlled by an instrument definition
use the use_remainder component and make it change to itself, or just make the use time 1000000 and make an advancement that triggers when you use that item
just use the use_remainder component lol
@balmy basin

you can't make the item give back itself, it's not recursive
OKAY I did it:
- make an advancement that tracks when you use the item
"criteria": {
"requirement": {
"trigger": "consume_item",
"conditions": {
"item": {
"components": {
"item_name": "[\"a\"]"
}
}
}
}
},
"rewards": {
"function": "sandwitches:staffs/forest"
}
}```
- in the function make it so that you get that same item but with one difference (or you will get visual bugs), depending on which one you have in hand.
#checks if its in mainhand or offhand and if its the first version or the second one
execute if items entity @s weapon.mainhand *[item_name="[\"a\"]",use_cooldown={seconds:0.8,cooldown_group:"foresta"}] run item replace entity @s weapon.mainhand with stick[minecraft:item_name="[\"a\"]",minecraft:consumable={consume_seconds:1,animation:none,has_consume_particles:false,sound:"block.amethyst_block.resonate"},use_cooldown={seconds:0.8,cooldown_group:"forestb"},max_stack_size=1]
execute if items entity @s weapon.offhand *[item_name="[\"a\"]",use_cooldown={seconds:0.8,cooldown_group:"forestb"}] unless items entity @s weapon.mainhand *[item_name="[\"a\"]"] run item replace entity @s weapon.offhand with stick[minecraft:item_name="[\"a\"]",minecraft:consumable={consume_seconds:1,animation:none,has_consume_particles:false,sound:"block.amethyst_block.resonate"},use_cooldown={seconds:0.8,cooldown_group:"foresta"},max_stack_size=1]
execute if items entity @s weapon.mainhand *[item_name="[\"a\"]",use_cooldown={seconds:0.8,cooldown_group:"forestb"}] run item replace entity @s weapon.mainhand with stick[minecraft:item_name="[\"a\"]",minecraft:consumable={consume_seconds:1,animation:none,has_consume_particles:false,sound:"block.amethyst_block.resonate"},use_cooldown={seconds:0.8,cooldown_group:"foresta"},max_stack_size=1]
advancement revoke @s only sandwitches:staff_of_the_forest```
idk if maybe discord made some of this not work because of "*" and other things
in "if items entity @s" after "weapon.mainhand" and "weapon.offhand" there is a space and a "*" before the components
It won't work if you put "consume_seconds" as 0
I think the lowest it can go to and still work is 0.05
and if you put seconds in use_cooldown as 0.05 there will be practically no cooldown
Oooooh!!!!
AWESOMEEEEE
I'm in the middle of something but I'll def check this out! :3
Ty!! ^^
Btw nice to meet u!!
🫡
yyippeee
I'm currently using this to create a wand for my data pack
woahs! :DD
wait so.... how does it work exactly? Like what are the steps? ^^
the advancement and function?
It's okii I'll study a lil later ^^
you can encapsulate code inbetween 3 graves like this:
{
"criteria": {
"requirement": {
"trigger": "consume_item",
"conditions": {
"item": {
"components": {
"item_name": "["Staff Of The Forest"]"
}
}
}
}
},
"rewards": {
"function": "sandwitches:staffs/forest"
}
}
oh ok I didn't know that thanks
Btw how's your datapack going?
I'm going to upload a new update in a few minutes I think
YAYYYY!!!
@balmy basin I might be able to help you out. I've got a similar system (I think for the staffs)
how's it going crews
Pretty good! I may close this thread because I have other things to ask, but ya
Hey, isn't there a component called use_cooldown?
There is