Skip to content

Projectile ​

abstract class · pocketmine\entity\projectile\Projectile · source

Extends Entity

Properties ​

$blockHit protected ​

php
protected ?\pocketmine\math\Vector3 $blockHit

$damage protected ​

php
protected float $damage

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Location $location, ?\pocketmine\entity\Entity $shootingEntity, ?\pocketmine\nbt\tag\CompoundTag $nbt = null)

applyDragBeforeGravity() protected ​

php
protected function applyDragBeforeGravity() : bool

attack() ​

php
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : void

calculateInterceptWithBlock() protected ​

php
protected function calculateInterceptWithBlock(\pocketmine\block\Block $block, \pocketmine\math\Vector3 $start, \pocketmine\math\Vector3 $end) : ?\pocketmine\math\RayTraceResult

Called 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() ​

php
public function canBeCollidedWith() : bool

canCollideWith() ​

php
public function canCollideWith(\pocketmine\entity\Entity $entity) : bool

despawnsOnEntityHit() protected ​

php
protected function despawnsOnEntityHit() : bool

Deprecated

This will be dropped in favor of deciding whether to despawn within onHitEntity() method.

getBaseDamage() ​

php
public function getBaseDamage() : float

Returns the base damage applied on collision. This is multiplied by the projectile's speed to give a result damage.

getResultDamage() ​

php
public function getResultDamage() : int

Returns the amount of damage this projectile will deal to the entity it hits.

hasMovementUpdate() ​

php
public function hasMovementUpdate() : bool

initEntity() protected ​

php
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : void

move() protected ​

php
protected function move(float $dx, float $dy, float $dz) : void

onHit() protected ​

php
protected function onHit(\pocketmine\event\entity\ProjectileHitEvent $event) : void

Called when the projectile hits something. Override this to perform non-target-specific effects when the projectile hits something.

onHitBlock() protected ​

php
protected function onHitBlock(\pocketmine\block\Block $blockHit, \pocketmine\math\RayTraceResult $hitResult) : void

Called when the projectile collides with a Block.

onHitEntity() protected ​

php
protected function onHitEntity(\pocketmine\entity\Entity $entityHit, \pocketmine\math\RayTraceResult $hitResult) : void

Called when the projectile collides with an Entity.

onNearbyBlockChange() ​

php
public function onNearbyBlockChange() : void

saveNBT() ​

php
public function saveNBT() : \pocketmine\nbt\tag\CompoundTag

setBaseDamage() ​

php
public function setBaseDamage(float $damage) : void

Sets the base amount of damage applied by the projectile.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.