#add cooldown to food
18 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
ok i figured out how to use the tag
ItemEvents.rightClicked(Item.of('#c:foods'), event => {
event.server.scheduleInTicks(1, () => {
event.player.addItemCooldown('minecraft:carrot', 400)
})
})
that works
but
then i tried same thing but on the cooldown
ItemEvents.rightClicked(Item.of('#c:foods'), event => {
event.server.scheduleInTicks(1, () => {
event.player.addItemCooldown(Item.of('#c:foods'), 400)
})
})
and this doesnt work
wait
it does work
it just only does items with ONLY that tag
if it has any other tags then it doesnt work
solved
ItemEvents.rightClicked('#c:foods', event => {
event.server.scheduleInTicks(1, () => {
let foodTagItems = Ingredient.of('#c:foods').getItemIds()
foodTagItems.forEach(id => {
event.player.addItemCooldown(id, 40)
})
})
})
Ticket re-opened!
nvm, right clicking anything adds cd to the tag
ItemEvents.rightClicked(event => {
if (Ingredient.of('#speedysmp:drugs').test(event.item)) {
event.server.scheduleInTicks(1, () => {
let foodTagItems = Ingredient.of('#speedysmp:drugs').getItemIds()
foodTagItems.forEach(id => {
event.player.addItemCooldown(id, 60)
})
})
}
})
fixed