Documentation

Arrow extends Projectile
in package

Table of Contents

MOTION_THRESHOLD  = 1.0E-5
PICKUP_ANY  = 1
PICKUP_CREATIVE  = 2
PICKUP_NONE  = 0
TAG_CRIT  = "crit"
STEP_CLIP_MULTIPLIER  = 0.4
TAG_PICKUP  = "pickup"
$boundingBox  : AxisAlignedBB
$canCollide  : bool
$fallDistance  : float
$isCollided  : bool
$isCollidedHorizontally  : bool
$isCollidedVertically  : bool
$keepMovement  : bool
$lastUpdate  : int
$noDamageTicks  : int
$onGround  : bool
$size  : EntitySizeInfo
$ticksLived  : int
$alwaysShowNameTag  : bool
$attributeMap  : AttributeMap
$blockHit  : Block|null
$blocksAround  : array<string|int, Block>|null
$canClimb  : bool
$canClimbWalls  : bool
$closed  : bool
$collideTicks  : int
$critical  : bool
$damage  : float
$drag  : mixed
$fireTicks  : int
$forceMovementUpdate  : bool
$gravity  : mixed
$gravityEnabled  : bool
$hasSpawned  : array<string|int, Player>
$id  : int
$immobile  : bool
$invisible  : bool
$isStatic  : bool
$justCreated  : bool
$lastDamageCause  : EntityDamageEvent|null
$lastLocation  : Location
$lastMotion  : Vector3
$location  : Location
$motion  : Vector3
$nameTag  : string
$nameTagVisible  : bool
$networkPropertiesDirty  : bool
$ownerId  : int|null
$pickupMode  : int
$punchKnockback  : float
$scale  : float
$scoreTag  : string
$server  : Server
$silent  : bool
$stepHeight  : float
$targetId  : int|null
$timings  : TimingsHandler
$ySize  : float
$closeInFlight  : bool
$entityCount  : int
$health  : float
$maxHealth  : int
$needsDespawn  : bool
$networkProperties  : EntityMetadataCollection
$savedWithChunk  : bool
__construct()  : mixed
__destruct()  : mixed
__toString()  : mixed
addMotion()  : void
Adds the given values to the entity's motion vector.
attack()  : void
broadcastAnimation()  : void
broadcastSound()  : void
Broadcasts a sound caused by the entity. If the entity is considered "silent", the sound will be dropped.
canBeCollidedWith()  : bool
canBeMovedByCurrents()  : bool
Returns whether this entity can be moved by currents in liquids.
canClimb()  : bool
Returns whether the entity is able to climb blocks such as ladders or vines.
canClimbWalls()  : bool
Returns whether this entity is climbing a block. By default this is only true if the entity is climbing a ladder or vine or similar block.
canCollideWith()  : bool
canSaveWithChunk()  : bool
Returns whether this entity will be saved when its chunk is unloaded.
close()  : void
Closes the entity and frees attached references.
despawnFrom()  : void
despawnFromAll()  : void
extinguish()  : void
flagForDespawn()  : void
Flags the entity to be removed from the world on the next tick.
getAttributeMap()  : AttributeMap
getBaseDamage()  : float
Returns the base damage applied on collision. This is multiplied by the projectile's speed to give a result damage.
getBoundingBox()  : AxisAlignedBB
getDirectionPlane()  : Vector2
getDirectionVector()  : Vector3
getEyeHeight()  : float
getEyePos()  : Vector3
getFallDistance()  : float
getFireTicks()  : int
getHealth()  : float
getHorizontalFacing()  : int
getId()  : int
getLastDamageCause()  : EntityDamageEvent|null
getLocation()  : Location
getMaxHealth()  : int
getMotion()  : Vector3
getNameTag()  : string
getNetworkProperties()  : EntityMetadataCollection
getNetworkTypeId()  : string
getOffsetPosition()  : Vector3
getOwningEntity()  : Entity|null
Returns the owning entity, or null if the entity was not found.
getOwningEntityId()  : int|null
Returns the entity ID of the owning entity, or null if the entity doesn't have an owner.
getPickupMode()  : int
getPosition()  : Position
getPunchKnockback()  : float
getResultDamage()  : int
Returns the amount of damage this projectile will deal to the entity it hits.
getScale()  : float
getScoreTag()  : string|null
getTargetEntity()  : Entity|null
Returns the entity's target entity, or null if not found.
getTargetEntityId()  : int|null
Returns the entity ID of the entity's target, or null if it doesn't have a target.
getViewers()  : array<string|int, Player>
getWorld()  : World
hasGravity()  : bool
hasMovementUpdate()  : bool
Returns whether the entity needs a movement update on the next tick.
heal()  : void
isAlive()  : bool
isClosed()  : bool
Returns whether the entity has been "closed".
isCritical()  : bool
isFireProof()  : bool
isFlaggedForDespawn()  : bool
isImmobile()  : bool
isInsideOfSolid()  : bool
isInvisible()  : bool
isNameTagAlwaysVisible()  : bool
isNameTagVisible()  : bool
isOnFire()  : bool
isOnGround()  : bool
isSilent()  : bool
isUnderwater()  : bool
kill()  : void
nextRuntimeId()  : int
Returns a new runtime entity ID for a new entity.
onCollideWithPlayer()  : void
onInteract()  : bool
Called when interacted or tapped by a Player. Returns whether something happened as a result of the interaction.
onNearbyBlockChange()  : void
onRandomUpdate()  : void
Called when a random update is performed on the chunk the entity is in. This happens when the chunk is within the ticking chunk range of a player (or chunk loader).
onUpdate()  : bool
resetFallDistance()  : void
respawnToAll()  : void
saveNBT()  : CompoundTag
scheduleUpdate()  : void
sendData()  : void
setBaseDamage()  : void
Sets the base amount of damage applied by the projectile.
setCanClimb()  : void
Sets whether the entity is able to climb climbable blocks.
setCanClimbWalls()  : void
Sets whether the entity is climbing a block. If true, the entity can climb anything.
setCanSaveWithChunk()  : void
Sets whether this entity will be saved when its chunk is unloaded. This can be used to prevent the entity being saved to disk.
setCritical()  : void
setFallDistance()  : void
setFireTicks()  : void
setForceMovementUpdate()  : void
Flags the entity as needing a movement update on the next tick. Setting this forces a movement update even if the entity's motion is zero. Used to trigger movement updates when blocks change near entities.
setHasGravity()  : void
setHealth()  : void
Sets the health of the Entity. This won't send any update to the players
setImmobile()  : void
setInvisible()  : void
setLastDamageCause()  : void
setMaxHealth()  : void
setMotion()  : bool
setNameTag()  : void
setNameTagAlwaysVisible()  : void
setNameTagVisible()  : void
setOnFire()  : void
setOwningEntity()  : void
Sets the owner of the entity. Passing null will remove the current owner.
setPickupMode()  : void
setPunchKnockback()  : void
setRotation()  : void
setScale()  : void
setScoreTag()  : void
setSilent()  : void
setTargetEntity()  : void
Sets the entity's target entity. Passing null will remove the current target.
spawnTo()  : void
spawnToAll()  : void
teleport()  : bool
addAttributes()  : void
applyDragBeforeGravity()  : bool
broadcastMotion()  : void
broadcastMovement()  : void
calculateInterceptWithBlock()  : RayTraceResult|null
Called by move() when raytracing blocks to discover whether the block should be considered as a point of impact.
checkBlockIntersections()  : void
checkGroundState()  : void
checkObstruction()  : bool
dealFireDamage()  : void
Called to deal damage to entities when they are on fire.
destroyCycles()  : void
Called when the entity is disposed, after all events have been fired. This should be used to perform destructive circular object references and things which could impact memory usage.
doOnFireTick()  : bool
entityBaseTick()  : bool
getAllNetworkData()  : array<string|int, MetadataProperty>
getBlocksAroundWithEntityInsideActions()  : array<string|int, Block>
getDirtyNetworkData()  : array<string|int, MetadataProperty>
getInitialSizeInfo()  : EntitySizeInfo
initEntity()  : void
move()  : void
onDeath()  : void
Override this to do actions on death.
onDeathUpdate()  : bool
Called to tick entities while dead. Returns whether the entity should be flagged for despawn yet.
onDispose()  : void
Called when the entity is disposed to clean up things like viewers. This SHOULD NOT destroy internal state, because it may be needed by descendent classes.
onHit()  : void
Called when the projectile hits something. Override this to perform non-target-specific effects when the projectile hits something.
onHitBlock()  : void
Called when the projectile collides with a Block.
onHitEntity()  : void
Called when the projectile collides with an Entity.
onHitGround()  : float|null
Called when a falling entity hits the ground.
recalculateBoundingBox()  : void
resetLastMovements()  : void
sendSpawnPacket()  : void
Called by spawnTo() to send whatever packets needed to spawn the entity to the client.
setPosition()  : bool
setPositionAndRotation()  : bool
syncNetworkData()  : void
tryChangeMovement()  : void
updateFallState()  : float|null
updateMovement()  : void

Constants

MOTION_THRESHOLD

public mixed MOTION_THRESHOLD = 1.0E-5

PICKUP_ANY

public mixed PICKUP_ANY = 1

PICKUP_CREATIVE

public mixed PICKUP_CREATIVE = 2

PICKUP_NONE

public mixed PICKUP_NONE = 0

TAG_CRIT

public mixed TAG_CRIT = "crit"

STEP_CLIP_MULTIPLIER

protected mixed STEP_CLIP_MULTIPLIER = 0.4

TAG_PICKUP

private mixed TAG_PICKUP = "pickup"

Properties

$canCollide

public bool $canCollide = true

$fallDistance

public float $fallDistance = 0.0

$isCollided

public bool $isCollided = false

$isCollidedHorizontally

public bool $isCollidedHorizontally = false

$isCollidedVertically

public bool $isCollidedVertically = false

$keepMovement

public bool $keepMovement = false

$lastUpdate

public int $lastUpdate

$noDamageTicks

public int $noDamageTicks = 0

$onGround

public bool $onGround = false

$ticksLived

public int $ticksLived = 0

$alwaysShowNameTag

protected bool $alwaysShowNameTag = false

$blocksAround

protected array<string|int, Block>|null $blocksAround

$canClimb

protected bool $canClimb = false

$canClimbWalls

protected bool $canClimbWalls = false

$closed

protected bool $closed = false

$collideTicks

protected int $collideTicks = 0

$critical

protected bool $critical = false

$damage

protected float $damage = 2.0

$drag

protected mixed $drag = 0.01

$fireTicks

protected int $fireTicks = 0

$forceMovementUpdate

protected bool $forceMovementUpdate = false

$gravity

protected mixed $gravity = 0.05

$gravityEnabled

protected bool $gravityEnabled = true

$hasSpawned

protected array<string|int, Player> $hasSpawned = []

$immobile

protected bool $immobile = false

$invisible

protected bool $invisible = false

$isStatic

protected bool $isStatic = false

$justCreated

protected bool $justCreated = true

$nameTag

protected string $nameTag = ""

$nameTagVisible

protected bool $nameTagVisible = true

$networkPropertiesDirty

protected bool $networkPropertiesDirty = false

$ownerId

protected int|null $ownerId = null

$pickupMode

protected int $pickupMode = self::PICKUP_ANY

$punchKnockback

protected float $punchKnockback = 0.0

$scale

protected float $scale = 1.0

$scoreTag

protected string $scoreTag = ""

$silent

protected bool $silent = false

$stepHeight

protected float $stepHeight = 0.0

$targetId

protected int|null $targetId = null

$ySize

protected float $ySize = 0.0

$closeInFlight

private bool $closeInFlight = false

$entityCount

private static int $entityCount = 1

$health

private float $health = 20.0

$maxHealth

private int $maxHealth = 20

$needsDespawn

private bool $needsDespawn = false

$savedWithChunk

private bool $savedWithChunk = true

Methods

__destruct()

public __destruct() : mixed
Return values
mixed

__toString()

public __toString() : mixed
Return values
mixed

addMotion()

Adds the given values to the entity's motion vector.

public addMotion(float $x, float $y, float $z) : void
Parameters
$x : float
$y : float
$z : float
Return values
void

broadcastAnimation()

public broadcastAnimation(Animation $animation[, array<string|int, Player>|null $targets = null ]) : void
Parameters
$animation : Animation
$targets : array<string|int, Player>|null = null
Return values
void

broadcastSound()

Broadcasts a sound caused by the entity. If the entity is considered "silent", the sound will be dropped.

public broadcastSound(Sound $sound[, array<string|int, Player>|null $targets = null ]) : void
Parameters
$sound : Sound
$targets : array<string|int, Player>|null = null
Return values
void

canBeCollidedWith()

public canBeCollidedWith() : bool
Return values
bool

canBeMovedByCurrents()

Returns whether this entity can be moved by currents in liquids.

public canBeMovedByCurrents() : bool
Return values
bool

canClimb()

Returns whether the entity is able to climb blocks such as ladders or vines.

public canClimb() : bool
Return values
bool

canClimbWalls()

Returns whether this entity is climbing a block. By default this is only true if the entity is climbing a ladder or vine or similar block.

public canClimbWalls() : bool
Return values
bool

canCollideWith()

public canCollideWith(Entity $entity) : bool
Parameters
$entity : Entity
Return values
bool

canSaveWithChunk()

Returns whether this entity will be saved when its chunk is unloaded.

public canSaveWithChunk() : bool
Return values
bool

close()

Closes the entity and frees attached references.

public final close() : void

WARNING: Entities are unusable after this has been executed!

Return values
void

despawnFrom()

public despawnFrom(Player $player[, bool $send = true ]) : void
Parameters
$player : Player
$send : bool = true
Tags
deprecated

WARNING: This function DOES NOT permanently hide the entity from the player. As soon as the entity or player moves, the player will once again be able to see the entity.

Return values
void

despawnFromAll()

public despawnFromAll() : void
Tags
deprecated

WARNING: This function DOES NOT permanently hide the entity from viewers. As soon as the entity or player moves, viewers will once again be able to see the entity.

Return values
void

extinguish()

public extinguish() : void
Return values
void

flagForDespawn()

Flags the entity to be removed from the world on the next tick.

public flagForDespawn() : void
Return values
void

getBaseDamage()

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

public getBaseDamage() : float
Return values
float

getEyeHeight()

public getEyeHeight() : float
Return values
float

getFallDistance()

public getFallDistance() : float
Return values
float

getFireTicks()

public getFireTicks() : int
Return values
int

getHealth()

public getHealth() : float
Return values
float

getHorizontalFacing()

public getHorizontalFacing() : int
Return values
int

getId()

public getId() : int
Return values
int

getMaxHealth()

public getMaxHealth() : int
Return values
int

getNameTag()

public getNameTag() : string
Return values
string

getNetworkTypeId()

public static getNetworkTypeId() : string
Return values
string

getOwningEntity()

Returns the owning entity, or null if the entity was not found.

public getOwningEntity() : Entity|null
Return values
Entity|null

getOwningEntityId()

Returns the entity ID of the owning entity, or null if the entity doesn't have an owner.

public getOwningEntityId() : int|null
Return values
int|null

getPickupMode()

public getPickupMode() : int
Return values
int

getPunchKnockback()

public getPunchKnockback() : float
Return values
float

getResultDamage()

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

public getResultDamage() : int
Return values
int

getScale()

public getScale() : float
Return values
float

getScoreTag()

public getScoreTag() : string|null
Return values
string|null

getTargetEntity()

Returns the entity's target entity, or null if not found.

public getTargetEntity() : Entity|null

This is used for things like hostile mobs attacking entities, and for fishing rods reeling hit entities in.

Return values
Entity|null

getTargetEntityId()

Returns the entity ID of the entity's target, or null if it doesn't have a target.

public getTargetEntityId() : int|null
Return values
int|null

getViewers()

public getViewers() : array<string|int, Player>
Return values
array<string|int, Player>

hasGravity()

public hasGravity() : bool
Return values
bool

hasMovementUpdate()

Returns whether the entity needs a movement update on the next tick.

public hasMovementUpdate() : bool
Return values
bool

isAlive()

public isAlive() : bool
Return values
bool

isClosed()

Returns whether the entity has been "closed".

public isClosed() : bool
Return values
bool

isCritical()

public isCritical() : bool
Return values
bool

isFireProof()

public isFireProof() : bool
Return values
bool

isFlaggedForDespawn()

public isFlaggedForDespawn() : bool
Return values
bool

isImmobile()

public isImmobile() : bool
Return values
bool

isInsideOfSolid()

public isInsideOfSolid() : bool
Return values
bool

isInvisible()

public isInvisible() : bool
Return values
bool

isNameTagAlwaysVisible()

public isNameTagAlwaysVisible() : bool
Return values
bool

isNameTagVisible()

public isNameTagVisible() : bool
Return values
bool

isOnFire()

public isOnFire() : bool
Return values
bool

isOnGround()

public isOnGround() : bool
Return values
bool

isSilent()

public isSilent() : bool
Return values
bool

isUnderwater()

public isUnderwater() : bool
Return values
bool

kill()

public kill() : void
Return values
void

nextRuntimeId()

Returns a new runtime entity ID for a new entity.

public static nextRuntimeId() : int
Return values
int

onCollideWithPlayer()

public onCollideWithPlayer(Player $player) : void
Parameters
$player : Player
Return values
void

onInteract()

Called when interacted or tapped by a Player. Returns whether something happened as a result of the interaction.

public onInteract(Player $player, Vector3 $clickPos) : bool
Parameters
$player : Player
$clickPos : Vector3
Return values
bool

onNearbyBlockChange()

public onNearbyBlockChange() : void
Return values
void

onRandomUpdate()

Called when a random update is performed on the chunk the entity is in. This happens when the chunk is within the ticking chunk range of a player (or chunk loader).

public onRandomUpdate() : void
Return values
void

onUpdate()

public onUpdate(int $currentTick) : bool
Parameters
$currentTick : int
Return values
bool

resetFallDistance()

public resetFallDistance() : void
Return values
void

respawnToAll()

public respawnToAll() : void
Return values
void

scheduleUpdate()

public final scheduleUpdate() : void
Return values
void

sendData()

public sendData(array<string|int, Player>|null $targets[, array<string|int, MetadataProperty$data = null ]) : void
Parameters
$targets : array<string|int, Player>|null
$data : array<string|int, MetadataProperty> = null

Properly formatted entity data, defaults to everything

Tags
phpstan-param

array<int, MetadataProperty> $data

Return values
void

setBaseDamage()

Sets the base amount of damage applied by the projectile.

public setBaseDamage(float $damage) : void
Parameters
$damage : float
Return values
void

setCanClimb()

Sets whether the entity is able to climb climbable blocks.

public setCanClimb([bool $value = true ]) : void
Parameters
$value : bool = true
Return values
void

setCanClimbWalls()

Sets whether the entity is climbing a block. If true, the entity can climb anything.

public setCanClimbWalls([bool $value = true ]) : void
Parameters
$value : bool = true
Return values
void

setCanSaveWithChunk()

Sets whether this entity will be saved when its chunk is unloaded. This can be used to prevent the entity being saved to disk.

public setCanSaveWithChunk(bool $value) : void
Parameters
$value : bool
Return values
void

setCritical()

public setCritical([bool $value = true ]) : void
Parameters
$value : bool = true
Return values
void

setFallDistance()

public setFallDistance(float $fallDistance) : void
Parameters
$fallDistance : float
Return values
void

setFireTicks()

public setFireTicks(int $fireTicks) : void
Parameters
$fireTicks : int
Tags
throws
InvalidArgumentException
Return values
void

setForceMovementUpdate()

Flags the entity as needing a movement update on the next tick. Setting this forces a movement update even if the entity's motion is zero. Used to trigger movement updates when blocks change near entities.

public final setForceMovementUpdate([bool $value = true ]) : void
Parameters
$value : bool = true
Return values
void

setHasGravity()

public setHasGravity([bool $v = true ]) : void
Parameters
$v : bool = true
Return values
void

setHealth()

Sets the health of the Entity. This won't send any update to the players

public setHealth(float $amount) : void
Parameters
$amount : float
Return values
void

setImmobile()

public setImmobile([bool $value = true ]) : void
Parameters
$value : bool = true
Return values
void

setInvisible()

public setInvisible([bool $value = true ]) : void
Parameters
$value : bool = true
Return values
void

setMaxHealth()

public setMaxHealth(int $amount) : void
Parameters
$amount : int
Return values
void

setMotion()

public setMotion(Vector3 $motion) : bool
Parameters
$motion : Vector3
Return values
bool

setNameTag()

public setNameTag(string $name) : void
Parameters
$name : string
Return values
void

setNameTagAlwaysVisible()

public setNameTagAlwaysVisible([bool $value = true ]) : void
Parameters
$value : bool = true
Return values
void

setNameTagVisible()

public setNameTagVisible([bool $value = true ]) : void
Parameters
$value : bool = true
Return values
void

setOnFire()

public setOnFire(int $seconds) : void
Parameters
$seconds : int
Return values
void

setOwningEntity()

Sets the owner of the entity. Passing null will remove the current owner.

public setOwningEntity(Entity|null $owner) : void
Parameters
$owner : Entity|null
Tags
throws
InvalidArgumentException

if the supplied entity is not valid

Return values
void

setPickupMode()

public setPickupMode(int $pickupMode) : void
Parameters
$pickupMode : int
Return values
void

setPunchKnockback()

public setPunchKnockback(float $punchKnockback) : void
Parameters
$punchKnockback : float
Return values
void

setRotation()

public setRotation(float $yaw, float $pitch) : void
Parameters
$yaw : float
$pitch : float
Return values
void

setScale()

public setScale(float $value) : void
Parameters
$value : float
Return values
void

setScoreTag()

public setScoreTag(string $score) : void
Parameters
$score : string
Return values
void

setSilent()

public setSilent([bool $value = true ]) : void
Parameters
$value : bool = true
Return values
void

setTargetEntity()

Sets the entity's target entity. Passing null will remove the current target.

public setTargetEntity(Entity|null $target) : void
Parameters
$target : Entity|null
Tags
throws
InvalidArgumentException

if the target entity is not valid

Return values
void

spawnTo()

public spawnTo(Player $player) : void
Parameters
$player : Player
Return values
void

spawnToAll()

public spawnToAll() : void
Return values
void

addAttributes()

protected addAttributes() : void
Return values
void

applyDragBeforeGravity()

protected applyDragBeforeGravity() : bool
Return values
bool

broadcastMotion()

protected broadcastMotion() : void
Return values
void

broadcastMovement()

protected broadcastMovement([bool $teleport = false ]) : void
Parameters
$teleport : bool = false
Return values
void

calculateInterceptWithBlock()

Called by move() when raytracing blocks to discover whether the block should be considered as a point of impact.

protected calculateInterceptWithBlock(Block $block, Vector3 $start, Vector3 $end) : RayTraceResult|null

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).

Parameters
$block : Block
$start : Vector3
$end : Vector3
Return values
RayTraceResult|null

the result of the ray trace if successful, or null if no interception is found.

checkBlockIntersections()

protected checkBlockIntersections() : void
Return values
void

checkGroundState()

protected checkGroundState(float $wantedX, float $wantedY, float $wantedZ, float $dx, float $dy, float $dz) : void
Parameters
$wantedX : float
$wantedY : float
$wantedZ : float
$dx : float
$dy : float
$dz : float
Return values
void

checkObstruction()

protected checkObstruction(float $x, float $y, float $z) : bool
Parameters
$x : float
$y : float
$z : float
Return values
bool

dealFireDamage()

Called to deal damage to entities when they are on fire.

protected dealFireDamage() : void
Return values
void

destroyCycles()

Called when the entity is disposed, after all events have been fired. This should be used to perform destructive circular object references and things which could impact memory usage.

protected destroyCycles() : void

It is expected that the object is unusable after this is called.

Return values
void

doOnFireTick()

protected doOnFireTick([int $tickDiff = 1 ]) : bool
Parameters
$tickDiff : int = 1
Return values
bool

entityBaseTick()

protected entityBaseTick([int $tickDiff = 1 ]) : bool
Parameters
$tickDiff : int = 1
Return values
bool

getAllNetworkData()

protected final getAllNetworkData() : array<string|int, MetadataProperty>
Tags
phpstan-return

array<int, MetadataProperty>

Return values
array<string|int, MetadataProperty>

getBlocksAroundWithEntityInsideActions()

protected getBlocksAroundWithEntityInsideActions() : array<string|int, Block>
Return values
array<string|int, Block>

getDirtyNetworkData()

protected final getDirtyNetworkData() : array<string|int, MetadataProperty>
Tags
phpstan-return

array<int, MetadataProperty>

Return values
array<string|int, MetadataProperty>

move()

protected move(float $dx, float $dy, float $dz) : void
Parameters
$dx : float
$dy : float
$dz : float
Return values
void

onDeath()

Override this to do actions on death.

protected onDeath() : void
Return values
void

onDeathUpdate()

Called to tick entities while dead. Returns whether the entity should be flagged for despawn yet.

protected onDeathUpdate(int $tickDiff) : bool
Parameters
$tickDiff : int
Return values
bool

onDispose()

Called when the entity is disposed to clean up things like viewers. This SHOULD NOT destroy internal state, because it may be needed by descendent classes.

protected onDispose() : void
Return values
void

onHit()

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

protected onHit(ProjectileHitEvent $event) : void
Parameters
$event : ProjectileHitEvent
Return values
void

onHitGround()

Called when a falling entity hits the ground.

protected onHitGround() : float|null
Return values
float|null

recalculateBoundingBox()

protected recalculateBoundingBox() : void
Return values
void

resetLastMovements()

protected resetLastMovements() : void
Return values
void

sendSpawnPacket()

Called by spawnTo() to send whatever packets needed to spawn the entity to the client.

protected sendSpawnPacket(Player $player) : void
Parameters
$player : Player
Return values
void

setPosition()

protected setPosition(Vector3 $pos) : bool
Parameters
$pos : Vector3
Return values
bool

setPositionAndRotation()

protected setPositionAndRotation(Vector3 $pos, float $yaw, float $pitch) : bool
Parameters
$pos : Vector3
$yaw : float
$pitch : float
Return values
bool

tryChangeMovement()

protected tryChangeMovement() : void
Return values
void

updateFallState()

protected updateFallState(float $distanceThisTick, bool $onGround) : float|null
Parameters
$distanceThisTick : float
$onGround : bool
Return values
float|null

updateMovement()

protected updateMovement([bool $teleport = false ]) : void
Parameters
$teleport : bool = false
Return values
void

Search results