Projectile
Extends Entity
Properties
$blockHit protected
protected ?\pocketmine\math\Vector3 $blockHit$damage protected
protected float $damageMethods
__construct()
public function __construct(\pocketmine\entity\Location $location, ?\pocketmine\entity\Entity $shootingEntity, ?\pocketmine\nbt\tag\CompoundTag $nbt = null)applyDragBeforeGravity() protected
protected function applyDragBeforeGravity() : boolattack()
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : voidcalculateInterceptWithBlock() protected
protected function calculateInterceptWithBlock(\pocketmine\block\Block $block, \pocketmine\math\Vector3 $start, \pocketmine\math\Vector3 $end) : ?\pocketmine\math\RayTraceResultCalled by move() when raytracing blocks to discover whether the block should be considered as a point of impact. This can be overridden by other projectiles to allow altering the blocks which are collided with (for example some projectiles collide with any non-air block).
canBeCollidedWith()
public function canBeCollidedWith() : boolcanCollideWith()
public function canCollideWith(\pocketmine\entity\Entity $entity) : booldespawnsOnEntityHit() protected
protected function despawnsOnEntityHit() : boolDeprecated
This will be dropped in favor of deciding whether to despawn within onHitEntity() method.
getBaseDamage()
public function getBaseDamage() : floatReturns the base damage applied on collision. This is multiplied by the projectile's speed to give a result damage.
getResultDamage()
public function getResultDamage() : intReturns the amount of damage this projectile will deal to the entity it hits.
hasMovementUpdate()
public function hasMovementUpdate() : boolinitEntity() protected
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : voidmove() protected
protected function move(float $dx, float $dy, float $dz) : voidonHit() protected
protected function onHit(\pocketmine\event\entity\ProjectileHitEvent $event) : voidCalled when the projectile hits something. Override this to perform non-target-specific effects when the projectile hits something.
onHitBlock() protected
protected function onHitBlock(\pocketmine\block\Block $blockHit, \pocketmine\math\RayTraceResult $hitResult) : voidCalled when the projectile collides with a Block.
onHitEntity() protected
protected function onHitEntity(\pocketmine\entity\Entity $entityHit, \pocketmine\math\RayTraceResult $hitResult) : voidCalled when the projectile collides with an Entity.
onNearbyBlockChange()
public function onNearbyBlockChange() : voidsaveNBT()
public function saveNBT() : \pocketmine\nbt\tag\CompoundTagsetBaseDamage()
public function setBaseDamage(float $damage) : voidSets the base amount of damage applied by the projectile.
