Hey. I want to boost a pig away like a snowball if a player interacts with the item id 1. I already tried something. But this only teleports the entity to a location and did not work like what I expected. PHP: public function interact(PlayerInteractEvent $event) {if($event->getItem()->getId() == 1) {//Don't really know how to create the entity ://*Code to create it?!*/$entity->addMovement($x, $y, $z);}}
If you are using addEntityPacket to spawn the entity, you can easily move her using the MoveEntityPacket