add(0, $player->getEyeHeight(), 0), $directionVector, $player->yaw, $player->pitch); $this->addExtraTags($nbt); $projectile = Entity::createEntity($this->getProjectileEntityType(), $player->getLevel(), $nbt, $player); if($projectile !== null){ $projectile->setMotion($projectile->getMotion()->multiply($this->getThrowForce())); } $this->count--; if($projectile instanceof Projectile){ $player->getServer()->getPluginManager()->callEvent($projectileEv = new ProjectileLaunchEvent($projectile)); if($projectileEv->isCancelled()){ $projectile->flagForDespawn(); }else{ $projectile->spawnToAll(); //319 is the Player's entity type ID in MCPE, with all its flags (which we don't know) //without this, it doesn't work at all. $player->getLevel()->broadcastLevelSoundEvent($player, LevelSoundEventPacket::SOUND_THROW, 319); } }elseif($projectile !== null){ $projectile->spawnToAll(); }else{ return false; } return true; } }