ANSWER: Yes you can, by using the .setOwner() method of your projectile entity. in my case, that would be projectile.setOwner(event.player)
Original Question:
To make a magic spells system, I'm spawning spell projectiles using event.level.createEntity(). but because of that they don't have an owner. I've tried several shots at changing the arrow's nbt data both before and after spawn, but it does not work.
Current attempt using arrows as projectiles:
ItemEvents.rightClicked('arrow',event => {
let p = event.player
let {x,y,z,lookAngle} = p
let proj = event.level.createEntity('minecraft:arrow')
proj.nbt.Owner = p.uuid
proj.setPosition(x,y+p.eyeHeight*0.7,z)
proj.noGravity = true
proj.addDeltaMovement(Vec3d(lookAngle.x(),lookAngle.y(),lookAngle.z()))
proj.spawn()
p.tell(proj.nbt)
})```