import { world} from "@minecraft/server";
import {
ActionFormData,
MessageFormData,
ModalFormData
} from "@minecraft/server-ui";
let r;
world.events.itemUse.subscribe(async function(evt){
if(evt.item.typeId === "ar:speer")
{
r = evt.source.rotation
}
})
world.events.entityCreate.subscribe((evt)=>{
if(evt.entity.typeId === "ar:thrown_speer")
{
evt.entity.setRotation(r.x,r.y)
}
})
when the item "ar:speer" is used it's spawn an entity called "ar:thrown_speer", what i want to do is set the rotation of "ar:thrown_speer" to the rotation of the player when it spawns but it doesn't work the way i did,can someone tell how to do it?