Trying to make a script that spawns in flint shards when a player is holding a piece of flint and clicks a stone block, but I can't seem to get the shards to spawn at all, this is my code right now:
ItemEvents.firstRightClicked("minecraft:flint", e => {
let {player, target, item} = e
if(target.block.id != 'minecraft:stone') return
item.shrink(1)
target.spawnAtLocation('blonded:flint_shard')
let {server, level} = player
let bpos = player.blockPosition()
level.players.forEach(lvlplayer => {
if(Math.sqrt(player.distanceToSqr(lvlplayer)) <= 10)
server.runCommandSilent(`playsound item.armor.equip_iron block ${lvlplayer.username} ${bpos.x} ${bpos.y} ${bpos.z} 1 1`)
})
})```
Which gives this error:
`[10:03:20] [Server thread/ERROR] [KubeJS Server/]: blonded/flint_knapping.js#4: Error in 'ItemEvents.firstRightClicked': TypeError: Cannot find function spawnAtLocation in object dev.latvian.mods.kubejs.entity.RayTraceResultJS@21a93d8f.`
So I can't use target.spawnAtLocation which I found in an old post, but what can I use in place of that?
