Aim 5.46.0
Aiming helpers for mobs shooting projectiles (arrows, tridents, potions, fireballs, wind charges).
Methods
facing()
public static function facing(\pocketmine\math\Vector3 $pos, \pocketmine\world\World $world, \pocketmine\math\Vector3 $motion) : \pocketmine\entity\LocationReturns a location at $pos facing along $motion (projectile yaw/pitch conventions).
gaussian()
public static function gaussian() : floatApproximately normally distributed random number (mean 0, deviation 1).
mobInaccuracy()
public static function mobInaccuracy(\pocketmine\world\World $world) : floatVanilla inaccuracy of mob projectiles: (14 - difficulty * 4) * 0.0075 per axis.
motionTowards()
public static function motionTowards(\pocketmine\math\Vector3 $from, \pocketmine\math\Vector3 $to, float $speed, float $inaccuracy = 0.0, float $lift = 0.0) : ?\pocketmine\math\Vector3Returns the motion of a projectile shot from $from at $speed blocks per tick towards $to, randomly deviated by $inaccuracy. $lift raises the aim by that fraction of the horizontal distance to make up for gravity (arrows: 0.2).
shootArrow()
public static function shootArrow(\pocketmine\entity\Living $shooter, \pocketmine\entity\Living $target, ?\pocketmine\item\PotionType $potion = null, float $speed = 1.6) : ?\pocketmine\entity\projectile\ArrowShoots an arrow from the shooter's eyes at the target like a skeleton (speed 1.6, aimed above the target for gravity), optionally tipped with a potion. Returns the arrow (already spawned), or null if the target is at the shooter's eyes.
targetPoint()
public static function targetPoint(\pocketmine\entity\Entity $target, float $heightFraction = 1 / 3) : \pocketmine\math\Vector3Returns the point a projectile should be aimed at on the target: a third of its height (vanilla), or its eyes.
