#Right click on block animation

4 messages · Page 1 of 1 (latest)

arctic nexus
#

Hello, I'm brand new to KubeJS, and I've got most of what I want to do figured out, but one thing I can't figure out is how to give a right click "swing" animation when my item is right clicked on a block

Here's where I handle all the right clicking

onEvent("block.right_click", event => {
    if (event.item.id != "kubejs:spawn_ignis" || event.hand != MAIN_HAND) return;
    
    let monstrosity = event.block.createEntity("cataclysm:netherite_monstrosity")
    monstrosity.y++
    monstrosity.spawn()
    event.item.count--
})```

And here is where I actually create the item
```js
onEvent('item.registry', event => {
    event.create('spawn_ignis')
    .maxStackSize(16)
    .displayName('Eternal Forge')
    .tooltip('Used to spawn the Ignis')
    .group('cataclysm')
})```

I've looked around on the wiki and in #1048591172165189632 and I can't seem to find it anywhere although I'm sure it's a simple task
green lichenBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

strange basin
#

try e.player.swing()

arctic nexus
# strange basin try `e.player.swing()`

Unfortunately that didn't work, swing isn't a function Error occurred while handling event 'block.right_click': TypeError: Cannot find function swing in object devJordan. (server_scripts:cataclysmSpawnEggs.js#16)