PocketMine-MP 5.12.1 git-72f3c0b4b9a4c6b5d1bc79a3b31d0568ccc2baa9
pocketmine\entity\Entity Class Reference
+ Inheritance diagram for pocketmine\entity\Entity:
+ Collaboration diagram for pocketmine\entity\Entity:

Public Member Functions

 __construct (Location $location, ?CompoundTag $nbt=null)
 
 __toString ()
 
 addMotion (float $x, float $y, float $z)
 
 attack (EntityDamageEvent $source)
 
 broadcastAnimation (Animation $animation, ?array $targets=null)
 
 broadcastSound (Sound $sound, ?array $targets=null)
 
 canBeCollidedWith ()
 
 canBeMovedByCurrents ()
 
 canBeRenamed ()
 
 canClimb ()
 
 canClimbWalls ()
 
 canCollideWith (Entity $entity)
 
 canSaveWithChunk ()
 
 close ()
 
 despawnFrom (Player $player, bool $send=true)
 
 despawnFromAll ()
 
 extinguish ()
 
 flagForDespawn ()
 
 getAttributeMap ()
 
 getBoundingBox ()
 
 getDirectionPlane ()
 
 getDirectionVector ()
 
 getEyeHeight ()
 
 getEyePos ()
 
 getFallDistance ()
 
 getFireTicks ()
 
 getGravity ()
 
 getHealth ()
 
 getHorizontalFacing ()
 
 getId ()
 
 getLastDamageCause ()
 
 getLocation ()
 
 getMaxHealth ()
 
 getMotion ()
 
 getNameTag ()
 
 getNetworkProperties ()
 
 getOffsetPosition (Vector3 $vector3)
 
 getOwningEntity ()
 
 getOwningEntityId ()
 
 getPosition ()
 
 getScale ()
 
 getScoreTag ()
 
 getSize ()
 
 getTargetEntity ()
 
 getTargetEntityId ()
 
 getViewers ()
 
 getWorld ()
 
 hasGravity ()
 
 hasMovementUpdate ()
 
 hasNoClientPredictions ()
 
 heal (EntityRegainHealthEvent $source)
 
 isAlive ()
 
 isClosed ()
 
 isFireProof ()
 
 isFlaggedForDespawn ()
 
 isInsideOfSolid ()
 
 isInvisible ()
 
 isNameTagAlwaysVisible ()
 
 isNameTagVisible ()
 
 isOnFire ()
 
 isOnGround ()
 
 isSilent ()
 
 isUnderwater ()
 
 kill ()
 
 onCollideWithPlayer (Player $player)
 
 onInteract (Player $player, Vector3 $clickPos)
 
 onNearbyBlockChange ()
 
 onRandomUpdate ()
 
 onUpdate (int $currentTick)
 
 resetFallDistance ()
 
 respawnToAll ()
 
 saveNBT ()
 
 scheduleUpdate ()
 
 sendData (?array $targets, ?array $data=null)
 
 setCanClimb (bool $value=true)
 
 setCanClimbWalls (bool $value=true)
 
 setCanSaveWithChunk (bool $value)
 
 setFallDistance (float $fallDistance)
 
 setFireTicks (int $fireTicks)
 
 setForceMovementUpdate (bool $value=true)
 
 setGravity (float $gravity)
 
 setHasGravity (bool $v=true)
 
 setHealth (float $amount)
 
 setInvisible (bool $value=true)
 
 setLastDamageCause (EntityDamageEvent $type)
 
 setMaxHealth (int $amount)
 
 setMotion (Vector3 $motion)
 
 setNameTag (string $name)
 
 setNameTagAlwaysVisible (bool $value=true)
 
 setNameTagVisible (bool $value=true)
 
 setNoClientPredictions (bool $value=true)
 
 setOnFire (int $seconds)
 
 setOwningEntity (?Entity $owner)
 
 setRotation (float $yaw, float $pitch)
 
 setScale (float $value)
 
 setScoreTag (string $score)
 
 setSilent (bool $value=true)
 
 setTargetEntity (?Entity $target)
 
 spawnTo (Player $player)
 
 spawnToAll ()
 
 teleport (Vector3 $pos, ?float $yaw=null, ?float $pitch=null)
 

Static Public Member Functions

static getNetworkTypeId ()
 
static nextRuntimeId ()
 

Public Attributes

AxisAlignedBB $boundingBox
 
float $fallDistance = 0.0
 
bool $isCollided = false
 
bool $isCollidedHorizontally = false
 
bool $isCollidedVertically = false
 
bool $keepMovement = false
 
int $lastUpdate
 
int $noDamageTicks = 0
 
bool $onGround = false
 
EntitySizeInfo $size
 
int $ticksLived = 0
 
const MOTION_THRESHOLD = 0.00001
 
const TAG_MOTION = "Motion"
 
const TAG_POS = "Pos"
 
const TAG_ROTATION = "Rotation"
 

Protected Member Functions

 addAttributes ()
 
 applyDragBeforeGravity ()
 
 broadcastMotion ()
 
 broadcastMovement (bool $teleport=false)
 
 checkBlockIntersections ()
 
 checkGroundState (float $wantedX, float $wantedY, float $wantedZ, float $dx, float $dy, float $dz)
 
 checkObstruction (float $x, float $y, float $z)
 
 dealFireDamage ()
 
 destroyCycles ()
 
 doOnFireTick (int $tickDiff=1)
 
 entityBaseTick (int $tickDiff=1)
 
 getAllNetworkData ()
 
 getBlocksAroundWithEntityInsideActions ()
 
 getBlocksIntersected (float $inset)
 
 getDirtyNetworkData ()
 
 getInitialDragMultiplier ()
 
 getInitialGravity ()
 
 getInitialSizeInfo ()
 
 initEntity (CompoundTag $nbt)
 
 move (float $dx, float $dy, float $dz)
 
 onDeath ()
 
 onDeathUpdate (int $tickDiff)
 
 onDispose ()
 
 onFirstUpdate (int $currentTick)
 
 onHitGround ()
 
 recalculateBoundingBox ()
 
 resetLastMovements ()
 
 sendSpawnPacket (Player $player)
 
 setPosition (Vector3 $pos)
 
 setPositionAndRotation (Vector3 $pos, float $yaw, float $pitch)
 
 setSize (EntitySizeInfo $size)
 
 syncNetworkData (EntityMetadataCollection $properties)
 
 tryChangeMovement ()
 
 updateFallState (float $distanceThisTick, bool $onGround)
 
 updateMovement (bool $teleport=false)
 

Protected Attributes

bool $alwaysShowNameTag = false
 
AttributeMap $attributeMap
 
array $blocksAround = null
 
bool $canClimb = false
 
bool $canClimbWalls = false
 
bool $closed = false
 
float $drag
 
int $fireTicks = 0
 
bool $forceMovementUpdate = false
 
float $gravity
 
bool $gravityEnabled = true
 
array $hasSpawned = []
 
int $id
 
bool $invisible = false
 
bool $justCreated = true
 
EntityDamageEvent $lastDamageCause = null
 
Location $lastLocation
 
Vector3 $lastMotion
 
Location $location
 
Vector3 $motion
 
string $nameTag = ""
 
bool $nameTagVisible = true
 
bool $networkPropertiesDirty = false
 
bool $noClientPredictions = false
 
int $ownerId = null
 
float $scale = 1.0
 
string $scoreTag = ""
 
Server $server
 
bool $silent = false
 
float $stepHeight = 0.0
 
int $targetId = null
 
TimingsHandler $timings
 
float $ySize = 0.0
 
const STEP_CLIP_MULTIPLIER = 0.4
 

Detailed Description

Definition at line 82 of file Entity.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\entity\Entity::__construct ( Location  $location,
?CompoundTag  $nbt = null 
)

Definition at line 183 of file Entity.php.

◆ __destruct()

pocketmine\entity\Entity::__destruct ( )

Definition at line 1701 of file Entity.php.

Member Function Documentation

◆ __toString()

pocketmine\entity\Entity::__toString ( )

Definition at line 1705 of file Entity.php.

◆ addAttributes()

pocketmine\entity\Entity::addAttributes ( )
protected

Definition at line 525 of file Entity.php.

◆ addMotion()

pocketmine\entity\Entity::addMotion ( float  $x,
float  $y,
float  $z 
)

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

Definition at line 1423 of file Entity.php.

Referenced by pocketmine\entity\effect\LevitationEffect\applyEffect().

+ Here is the caller graph for this function:

◆ applyDragBeforeGravity()

pocketmine\entity\Entity::applyDragBeforeGravity ( )
protected

Definition at line 823 of file Entity.php.

◆ attack()

pocketmine\entity\Entity::attack ( EntityDamageEvent  $source)

Definition at line 529 of file Entity.php.

◆ broadcastAnimation()

pocketmine\entity\Entity::broadcastAnimation ( Animation  $animation,
?array  $targets = null 
)
Parameters
Player[] | null$targets

Reimplemented in pocketmine\player\Player.

Definition at line 1687 of file Entity.php.

◆ broadcastMotion()

pocketmine\entity\Entity::broadcastMotion ( )
protected

Definition at line 802 of file Entity.php.

◆ broadcastMovement()

pocketmine\entity\Entity::broadcastMovement ( bool  $teleport = false)
protected

Definition at line 784 of file Entity.php.

◆ broadcastSound()

pocketmine\entity\Entity::broadcastSound ( Sound  $sound,
?array  $targets = null 
)

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

Parameters
Player[] | null$targets

Reimplemented in pocketmine\player\Player.

Definition at line 1695 of file Entity.php.

◆ canBeCollidedWith()

pocketmine\entity\Entity::canBeCollidedWith ( )

Definition at line 750 of file Entity.php.

◆ canBeMovedByCurrents()

pocketmine\entity\Entity::canBeMovedByCurrents ( )

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

Reimplemented in pocketmine\entity\object\FallingBlock, and pocketmine\player\Player.

Definition at line 1304 of file Entity.php.

◆ canBeRenamed()

pocketmine\entity\Entity::canBeRenamed ( )

Returns whether players can rename this entity using a name tag. Note that plugins can still name entities using setNameTag().

Reimplemented in pocketmine\entity\Living, and pocketmine\player\Player.

Definition at line 259 of file Entity.php.

◆ canClimb()

pocketmine\entity\Entity::canClimb ( )

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

Definition at line 368 of file Entity.php.

◆ canClimbWalls()

pocketmine\entity\Entity::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.

Definition at line 383 of file Entity.php.

◆ canCollideWith()

pocketmine\entity\Entity::canCollideWith ( Entity  $entity)

Definition at line 746 of file Entity.php.

◆ canSaveWithChunk()

pocketmine\entity\Entity::canSaveWithChunk ( )

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

Reimplemented in pocketmine\entity\object\ItemEntity, and pocketmine\player\Player.

Definition at line 459 of file Entity.php.

◆ checkBlockIntersections()

pocketmine\entity\Entity::checkBlockIntersections ( )
protected

Definition at line 1308 of file Entity.php.

◆ checkGroundState()

pocketmine\entity\Entity::checkGroundState ( float  $wantedX,
float  $wantedY,
float  $wantedZ,
float  $dx,
float  $dy,
float  $dz 
)
protected

Definition at line 1252 of file Entity.php.

◆ checkObstruction()

pocketmine\entity\Entity::checkObstruction ( float  $x,
float  $y,
float  $z 
)
protected

Definition at line 851 of file Entity.php.

◆ close()

pocketmine\entity\Entity::close ( )
final

Closes the entity and frees attached references.

WARNING: Entities are unusable after this has been executed!

Definition at line 1587 of file Entity.php.

◆ dealFireDamage()

pocketmine\entity\Entity::dealFireDamage ( )
protected

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

Definition at line 741 of file Entity.php.

◆ despawnFrom()

pocketmine\entity\Entity::despawnFrom ( Player  $player,
bool  $send = true 
)
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.

Definition at line 1541 of file Entity.php.

◆ despawnFromAll()

pocketmine\entity\Entity::despawnFromAll ( )
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.

Definition at line 1555 of file Entity.php.

◆ destroyCycles()

pocketmine\entity\Entity::destroyCycles ( )
protected

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.

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

Reimplemented in pocketmine\entity\Human, pocketmine\entity\Living, and pocketmine\player\Player.

Definition at line 1620 of file Entity.php.

◆ doOnFireTick()

pocketmine\entity\Entity::doOnFireTick ( int  $tickDiff = 1)
protected

Definition at line 717 of file Entity.php.

◆ entityBaseTick()

pocketmine\entity\Entity::entityBaseTick ( int  $tickDiff = 1)
protected

Definition at line 634 of file Entity.php.

◆ extinguish()

pocketmine\entity\Entity::extinguish ( )

Definition at line 708 of file Entity.php.

◆ flagForDespawn()

pocketmine\entity\Entity::flagForDespawn ( )

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

Definition at line 1566 of file Entity.php.

◆ getAllNetworkData()

pocketmine\entity\Entity::getAllNetworkData ( )
finalprotected
Returns
MetadataProperty[] @phpstan-return array<int, MetadataProperty>

Definition at line 1653 of file Entity.php.

◆ getAttributeMap()

pocketmine\entity\Entity::getAttributeMap ( )

Definition at line 626 of file Entity.php.

◆ getBlocksAroundWithEntityInsideActions()

pocketmine\entity\Entity::getBlocksAroundWithEntityInsideActions ( )
protected
Returns
Block[]

Definition at line 1286 of file Entity.php.

◆ getBlocksIntersected()

pocketmine\entity\Entity::getBlocksIntersected ( float  $inset)
protected

Yields all the blocks whose full-cube areas are intersected by the entity's AABB.

@phpstan-return \Generator<int, Block, void, void>

Definition at line 1264 of file Entity.php.

◆ getBoundingBox()

pocketmine\entity\Entity::getBoundingBox ( )

Definition at line 299 of file Entity.php.

◆ getDirectionPlane()

pocketmine\entity\Entity::getDirectionPlane ( )

Definition at line 953 of file Entity.php.

◆ getDirectionVector()

pocketmine\entity\Entity::getDirectionVector ( )

Definition at line 944 of file Entity.php.

◆ getDirtyNetworkData()

pocketmine\entity\Entity::getDirtyNetworkData ( )
finalprotected
Returns
MetadataProperty[] @phpstan-return array<int, MetadataProperty>

Definition at line 1641 of file Entity.php.

◆ getEyeHeight()

pocketmine\entity\Entity::getEyeHeight ( )

Definition at line 1100 of file Entity.php.

◆ getEyePos()

pocketmine\entity\Entity::getEyePos ( )

Definition at line 1104 of file Entity.php.

◆ getFallDistance()

pocketmine\entity\Entity::getFallDistance ( )

Definition at line 1065 of file Entity.php.

◆ getFireTicks()

pocketmine\entity\Entity::getFireTicks ( )

Definition at line 691 of file Entity.php.

◆ getGravity()

pocketmine\entity\Entity::getGravity ( )

Definition at line 806 of file Entity.php.

◆ getHealth()

pocketmine\entity\Entity::getHealth ( )

Definition at line 583 of file Entity.php.

◆ getHorizontalFacing()

pocketmine\entity\Entity::getHorizontalFacing ( )

Definition at line 925 of file Entity.php.

◆ getId()

pocketmine\entity\Entity::getId ( )

Definition at line 1473 of file Entity.php.

◆ getInitialDragMultiplier()

pocketmine\entity\Entity::getInitialDragMultiplier ( )
abstractprotected

Returns the percentage by which the entity's velocity is reduced per tick when moving through air. The entity's velocity is multiplied by 1 minus this value.

Returns
float 0-1

Reimplemented in pocketmine\entity\Living, pocketmine\entity\object\ExperienceOrb, pocketmine\entity\object\FallingBlock, pocketmine\entity\object\ItemEntity, pocketmine\entity\object\Painting, pocketmine\entity\object\PrimedTNT, pocketmine\entity\projectile\Arrow, and pocketmine\entity\projectile\Throwable.

◆ getInitialGravity()

◆ getLastDamageCause()

pocketmine\entity\Entity::getLastDamageCause ( )

Definition at line 622 of file Entity.php.

◆ getLocation()

pocketmine\entity\Entity::getLocation ( )

Definition at line 1334 of file Entity.php.

◆ getMaxHealth()

pocketmine\entity\Entity::getMaxHealth ( )

Definition at line 610 of file Entity.php.

◆ getMotion()

pocketmine\entity\Entity::getMotion ( )

Definition at line 1397 of file Entity.php.

◆ getNameTag()

pocketmine\entity\Entity::getNameTag ( )

Definition at line 243 of file Entity.php.

◆ getNetworkProperties()

pocketmine\entity\Entity::getNetworkProperties ( )

Definition at line 630 of file Entity.php.

◆ getOffsetPosition()

pocketmine\entity\Entity::getOffsetPosition ( Vector3  $vector3)

Definition at line 780 of file Entity.php.

◆ getOwningEntity()

pocketmine\entity\Entity::getOwningEntity ( )

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

Definition at line 405 of file Entity.php.

References pocketmine\server().

+ Here is the call graph for this function:

◆ getOwningEntityId()

pocketmine\entity\Entity::getOwningEntityId ( )

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

Definition at line 398 of file Entity.php.

◆ getPosition()

pocketmine\entity\Entity::getPosition ( )

Definition at line 1330 of file Entity.php.

◆ getScale()

pocketmine\entity\Entity::getScale ( )

Definition at line 287 of file Entity.php.

◆ getScoreTag()

pocketmine\entity\Entity::getScoreTag ( )

Definition at line 278 of file Entity.php.

◆ getSize()

pocketmine\entity\Entity::getSize ( )

Definition at line 316 of file Entity.php.

◆ getTargetEntity()

pocketmine\entity\Entity::getTargetEntity ( )

Returns the entity's target entity, or null if not found. This is used for things like hostile mobs attacking entities, and for fishing rods reeling hit entities in.

Definition at line 436 of file Entity.php.

References pocketmine\server().

+ Here is the call graph for this function:

◆ getTargetEntityId()

pocketmine\entity\Entity::getTargetEntityId ( )

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

Definition at line 428 of file Entity.php.

◆ getViewers()

pocketmine\entity\Entity::getViewers ( )
Returns
Player[]

Definition at line 1480 of file Entity.php.

◆ getWorld()

pocketmine\entity\Entity::getWorld ( )

Definition at line 1338 of file Entity.php.

◆ hasGravity()

pocketmine\entity\Entity::hasGravity ( )

Definition at line 815 of file Entity.php.

◆ hasMovementUpdate()

pocketmine\entity\Entity::hasMovementUpdate ( )

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

Reimplemented in pocketmine\entity\object\Painting, and pocketmine\entity\projectile\Projectile.

Definition at line 1055 of file Entity.php.

◆ hasNoClientPredictions()

pocketmine\entity\Entity::hasNoClientPredictions ( )

Returns whether clients may predict this entity's behaviour and movement. Used for things like water movement, burning, and movement smoothing (interpolation).

Definition at line 330 of file Entity.php.

◆ heal()

pocketmine\entity\Entity::heal ( EntityRegainHealthEvent  $source)

Definition at line 548 of file Entity.php.

◆ initEntity()

pocketmine\entity\Entity::initEntity ( CompoundTag  $nbt)
protected

Definition at line 506 of file Entity.php.

◆ isAlive()

pocketmine\entity\Entity::isAlive ( )

Definition at line 579 of file Entity.php.

◆ isClosed()

pocketmine\entity\Entity::isClosed ( )

Returns whether the entity has been "closed".

Definition at line 1578 of file Entity.php.

◆ isFireProof()

pocketmine\entity\Entity::isFireProof ( )

Definition at line 713 of file Entity.php.

◆ isFlaggedForDespawn()

pocketmine\entity\Entity::isFlaggedForDespawn ( )

Definition at line 1571 of file Entity.php.

◆ isInsideOfSolid()

pocketmine\entity\Entity::isInsideOfSolid ( )

Definition at line 1130 of file Entity.php.

◆ isInvisible()

pocketmine\entity\Entity::isInvisible ( )

Definition at line 347 of file Entity.php.

◆ isNameTagAlwaysVisible()

pocketmine\entity\Entity::isNameTagAlwaysVisible ( )

Definition at line 251 of file Entity.php.

◆ isNameTagVisible()

pocketmine\entity\Entity::isNameTagVisible ( )

Definition at line 247 of file Entity.php.

◆ isOnFire()

pocketmine\entity\Entity::isOnFire ( )

Definition at line 679 of file Entity.php.

◆ isOnGround()

pocketmine\entity\Entity::isOnGround ( )

Definition at line 1430 of file Entity.php.

◆ isSilent()

pocketmine\entity\Entity::isSilent ( )

Definition at line 356 of file Entity.php.

◆ isUnderwater()

pocketmine\entity\Entity::isUnderwater ( )

Definition at line 1119 of file Entity.php.

◆ kill()

pocketmine\entity\Entity::kill ( )

Definition at line 557 of file Entity.php.

◆ move()

pocketmine\entity\Entity::move ( float  $dx,
float  $dy,
float  $dz 
)
protected

Definition at line 1136 of file Entity.php.

◆ nextRuntimeId()

static pocketmine\entity\Entity::nextRuntimeId ( )
static

Returns a new runtime entity ID for a new entity.

Definition at line 101 of file Entity.php.

Referenced by pocketmine\world\particle\FloatingTextParticle\encode().

+ Here is the caller graph for this function:

◆ onCollideWithPlayer()

pocketmine\entity\Entity::onCollideWithPlayer ( Player  $player)

Definition at line 1108 of file Entity.php.

◆ onDeath()

pocketmine\entity\Entity::onDeath ( )
protected

Override this to do actions on death.

Reimplemented in pocketmine\entity\Living, pocketmine\entity\object\Painting, and pocketmine\player\Player.

Definition at line 568 of file Entity.php.

◆ onDeathUpdate()

pocketmine\entity\Entity::onDeathUpdate ( int  $tickDiff)
protected

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

Reimplemented in pocketmine\entity\Living, and pocketmine\player\Player.

Definition at line 575 of file Entity.php.

◆ onDispose()

pocketmine\entity\Entity::onDispose ( )
protected

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.

Reimplemented in pocketmine\entity\Human, pocketmine\entity\Living, and pocketmine\player\Player.

Definition at line 1607 of file Entity.php.

◆ onFirstUpdate()

pocketmine\entity\Entity::onFirstUpdate ( int  $currentTick)
protected

Called from onUpdate() on the first tick of a new entity. This is called before any movement processing or main ticking logic. Use this to fire any events related to spawning the entity.

Reimplemented in pocketmine\entity\object\ItemEntity.

Definition at line 961 of file Entity.php.

◆ onHitGround()

pocketmine\entity\Entity::onHitGround ( )
protected

Called when a falling entity hits the ground.

Reimplemented in pocketmine\entity\Living, and pocketmine\entity\object\FallingBlock.

Definition at line 1096 of file Entity.php.

◆ onInteract()

pocketmine\entity\Entity::onInteract ( Player  $player,
Vector3  $clickPos 
)

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

Definition at line 1115 of file Entity.php.

◆ onNearbyBlockChange()

pocketmine\entity\Entity::onNearbyBlockChange ( )

Definition at line 1029 of file Entity.php.

◆ onRandomUpdate()

pocketmine\entity\Entity::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).

Reimplemented in pocketmine\entity\object\Painting.

Definition at line 1038 of file Entity.php.

◆ onUpdate()

pocketmine\entity\Entity::onUpdate ( int  $currentTick)

Definition at line 965 of file Entity.php.

◆ recalculateBoundingBox()

pocketmine\entity\Entity::recalculateBoundingBox ( )
protected

Definition at line 303 of file Entity.php.

◆ resetFallDistance()

pocketmine\entity\Entity::resetFallDistance ( )

Definition at line 1071 of file Entity.php.

◆ resetLastMovements()

pocketmine\entity\Entity::resetLastMovements ( )
protected

Definition at line 1392 of file Entity.php.

◆ respawnToAll()

pocketmine\entity\Entity::respawnToAll ( )

Definition at line 1530 of file Entity.php.

◆ saveNBT()

pocketmine\entity\Entity::saveNBT ( )

Definition at line 471 of file Entity.php.

◆ scheduleUpdate()

pocketmine\entity\Entity::scheduleUpdate ( )
final

Definition at line 1022 of file Entity.php.

◆ sendData()

pocketmine\entity\Entity::sendData ( ?array  $targets,
?array  $data = null 
)
Parameters
Player[] | null$targets
MetadataProperty[]$dataProperly formatted entity data, defaults to everything

@phpstan-param array<int, MetadataProperty> $data

Reimplemented in pocketmine\player\Player.

Definition at line 1630 of file Entity.php.

◆ sendSpawnPacket()

pocketmine\entity\Entity::sendSpawnPacket ( Player  $player)
protected

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

Reimplemented in pocketmine\entity\Human, pocketmine\entity\Living, pocketmine\entity\object\ItemEntity, and pocketmine\entity\object\Painting.

Definition at line 1489 of file Entity.php.

◆ setCanClimb()

pocketmine\entity\Entity::setCanClimb ( bool  $value = true)

Sets whether the entity is able to climb climbable blocks.

Definition at line 375 of file Entity.php.

◆ setCanClimbWalls()

pocketmine\entity\Entity::setCanClimbWalls ( bool  $value = true)

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

Definition at line 390 of file Entity.php.

◆ setCanSaveWithChunk()

pocketmine\entity\Entity::setCanSaveWithChunk ( bool  $value)

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

Reimplemented in pocketmine\player\Player.

Definition at line 467 of file Entity.php.

◆ setFallDistance()

pocketmine\entity\Entity::setFallDistance ( float  $fallDistance)

Definition at line 1067 of file Entity.php.

◆ setFireTicks()

pocketmine\entity\Entity::setFireTicks ( int  $fireTicks)
Exceptions

InvalidArgumentException

Definition at line 698 of file Entity.php.

◆ setForceMovementUpdate()

pocketmine\entity\Entity::setForceMovementUpdate ( bool  $value = true)
final

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.

Definition at line 1046 of file Entity.php.

◆ setGravity()

pocketmine\entity\Entity::setGravity ( float  $gravity)

Definition at line 810 of file Entity.php.

◆ setHasGravity()

pocketmine\entity\Entity::setHasGravity ( bool  $v = true)

Definition at line 819 of file Entity.php.

◆ setHealth()

pocketmine\entity\Entity::setHealth ( float  $amount)

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

Reimplemented in pocketmine\entity\Living.

Definition at line 590 of file Entity.php.

◆ setInvisible()

pocketmine\entity\Entity::setInvisible ( bool  $value = true)

Definition at line 351 of file Entity.php.

◆ setLastDamageCause()

pocketmine\entity\Entity::setLastDamageCause ( EntityDamageEvent  $type)

Definition at line 618 of file Entity.php.

◆ setMaxHealth()

pocketmine\entity\Entity::setMaxHealth ( int  $amount)

Definition at line 614 of file Entity.php.

◆ setMotion()

pocketmine\entity\Entity::setMotion ( Vector3  $motion)

Definition at line 1401 of file Entity.php.

◆ setNameTag()

pocketmine\entity\Entity::setNameTag ( string  $name)

Definition at line 263 of file Entity.php.

◆ setNameTagAlwaysVisible()

pocketmine\entity\Entity::setNameTagAlwaysVisible ( bool  $value = true)

Definition at line 273 of file Entity.php.

◆ setNameTagVisible()

pocketmine\entity\Entity::setNameTagVisible ( bool  $value = true)

Definition at line 268 of file Entity.php.

◆ setNoClientPredictions()

pocketmine\entity\Entity::setNoClientPredictions ( bool  $value = true)

Things such as movement in water, burning, etc. may be predicted by the client. This is sometimes not desirable, since server-side logic may differ from client-side prediction. However, things like movement smoothing (interpolation) are also controlled by this, so it should be used with care.

Setting this flag will also disable player movement inputs, but this should not be relied on, as cheat clients will be able to bypass it.

Definition at line 342 of file Entity.php.

◆ setOnFire()

pocketmine\entity\Entity::setOnFire ( int  $seconds)

Definition at line 683 of file Entity.php.

◆ setOwningEntity()

pocketmine\entity\Entity::setOwningEntity ( ?Entity  $owner)

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

Exceptions

InvalidArgumentException if the supplied entity is not valid

Definition at line 414 of file Entity.php.

◆ setPosition()

pocketmine\entity\Entity::setPosition ( Vector3  $pos)
protected

Definition at line 1342 of file Entity.php.

◆ setPositionAndRotation()

pocketmine\entity\Entity::setPositionAndRotation ( Vector3  $pos,
float  $yaw,
float  $pitch 
)
protected

Definition at line 1382 of file Entity.php.

◆ setRotation()

pocketmine\entity\Entity::setRotation ( float  $yaw,
float  $pitch 
)

Definition at line 1374 of file Entity.php.

◆ setScale()

pocketmine\entity\Entity::setScale ( float  $value)

Definition at line 291 of file Entity.php.

◆ setScoreTag()

pocketmine\entity\Entity::setScoreTag ( string  $score)

Definition at line 282 of file Entity.php.

◆ setSilent()

pocketmine\entity\Entity::setSilent ( bool  $value = true)

Definition at line 360 of file Entity.php.

◆ setSize()

pocketmine\entity\Entity::setSize ( EntitySizeInfo  $size)
protected

Definition at line 320 of file Entity.php.

◆ setTargetEntity()

pocketmine\entity\Entity::setTargetEntity ( ?Entity  $target)

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

Exceptions

InvalidArgumentException if the target entity is not valid

Definition at line 445 of file Entity.php.

◆ spawnTo()

pocketmine\entity\Entity::spawnTo ( Player  $player)

Definition at line 1509 of file Entity.php.

◆ spawnToAll()

pocketmine\entity\Entity::spawnToAll ( )

Definition at line 1521 of file Entity.php.

◆ syncNetworkData()

pocketmine\entity\Entity::syncNetworkData ( EntityMetadataCollection  $properties)
protected

Definition at line 1661 of file Entity.php.

◆ teleport()

pocketmine\entity\Entity::teleport ( Vector3  $pos,
?float  $yaw = null,
?float  $pitch = null 
)
Parameters
Vector3 | Position | Location$pos

Reimplemented in pocketmine\player\Player.

Definition at line 1437 of file Entity.php.

Referenced by pocketmine\item\ChorusFruit\onConsume().

+ Here is the caller graph for this function:

◆ tryChangeMovement()

pocketmine\entity\Entity::tryChangeMovement ( )
protected

Definition at line 827 of file Entity.php.

◆ updateFallState()

pocketmine\entity\Entity::updateFallState ( float  $distanceThisTick,
bool  $onGround 
)
protected

Definition at line 1075 of file Entity.php.

◆ updateMovement()

pocketmine\entity\Entity::updateMovement ( bool  $teleport = false)
protected

Definition at line 754 of file Entity.php.

Member Data Documentation

◆ $alwaysShowNameTag

bool pocketmine\entity\Entity::$alwaysShowNameTag = false
protected

Definition at line 168 of file Entity.php.

◆ $attributeMap

AttributeMap pocketmine\entity\Entity::$attributeMap
protected

Definition at line 150 of file Entity.php.

◆ $blocksAround

array pocketmine\entity\Entity::$blocksAround = null
protected

Definition at line 115 of file Entity.php.

◆ $boundingBox

AxisAlignedBB pocketmine\entity\Entity::$boundingBox

Definition at line 124 of file Entity.php.

◆ $canClimb

bool pocketmine\entity\Entity::$canClimb = false
protected

Definition at line 172 of file Entity.php.

◆ $canClimbWalls

bool pocketmine\entity\Entity::$canClimbWalls = false
protected

Definition at line 173 of file Entity.php.

◆ $closed

bool pocketmine\entity\Entity::$closed = false
protected

Definition at line 158 of file Entity.php.

◆ $drag

float pocketmine\entity\Entity::$drag
protected

Definition at line 153 of file Entity.php.

◆ $fallDistance

float pocketmine\entity\Entity::$fallDistance = 0.0

Definition at line 136 of file Entity.php.

◆ $fireTicks

int pocketmine\entity\Entity::$fireTicks = 0
protected

Definition at line 139 of file Entity.php.

◆ $forceMovementUpdate

bool pocketmine\entity\Entity::$forceMovementUpdate = false
protected

Definition at line 121 of file Entity.php.

◆ $gravity

float pocketmine\entity\Entity::$gravity
protected

Definition at line 152 of file Entity.php.

◆ $gravityEnabled

bool pocketmine\entity\Entity::$gravityEnabled = true
protected

Definition at line 154 of file Entity.php.

◆ $hasSpawned

array pocketmine\entity\Entity::$hasSpawned = []
protected

Definition at line 106 of file Entity.php.

◆ $id

int pocketmine\entity\Entity::$id
protected

Definition at line 108 of file Entity.php.

◆ $invisible

bool pocketmine\entity\Entity::$invisible = false
protected

Definition at line 175 of file Entity.php.

◆ $isCollided

bool pocketmine\entity\Entity::$isCollided = false

Definition at line 143 of file Entity.php.

◆ $isCollidedHorizontally

bool pocketmine\entity\Entity::$isCollidedHorizontally = false

Definition at line 144 of file Entity.php.

◆ $isCollidedVertically

bool pocketmine\entity\Entity::$isCollidedVertically = false

Definition at line 145 of file Entity.php.

◆ $justCreated

bool pocketmine\entity\Entity::$justCreated = true
protected

Definition at line 148 of file Entity.php.

◆ $keepMovement

bool pocketmine\entity\Entity::$keepMovement = false

Definition at line 134 of file Entity.php.

◆ $lastDamageCause

EntityDamageEvent pocketmine\entity\Entity::$lastDamageCause = null
protected

Definition at line 112 of file Entity.php.

◆ $lastLocation

Location pocketmine\entity\Entity::$lastLocation
protected

Definition at line 118 of file Entity.php.

◆ $lastMotion

Vector3 pocketmine\entity\Entity::$lastMotion
protected

Definition at line 120 of file Entity.php.

◆ $lastUpdate

int pocketmine\entity\Entity::$lastUpdate

Definition at line 138 of file Entity.php.

◆ $location

Location pocketmine\entity\Entity::$location
protected

Definition at line 117 of file Entity.php.

◆ $motion

Vector3 pocketmine\entity\Entity::$motion
protected

Definition at line 119 of file Entity.php.

◆ $nameTag

string pocketmine\entity\Entity::$nameTag = ""
protected

Definition at line 166 of file Entity.php.

◆ $nameTagVisible

bool pocketmine\entity\Entity::$nameTagVisible = true
protected

Definition at line 167 of file Entity.php.

◆ $networkPropertiesDirty

bool pocketmine\entity\Entity::$networkPropertiesDirty = false
protected

Definition at line 164 of file Entity.php.

◆ $noClientPredictions

bool pocketmine\entity\Entity::$noClientPredictions = false
protected

Definition at line 174 of file Entity.php.

◆ $noDamageTicks

int pocketmine\entity\Entity::$noDamageTicks = 0

Definition at line 147 of file Entity.php.

◆ $onGround

bool pocketmine\entity\Entity::$onGround = false

Definition at line 125 of file Entity.php.

◆ $ownerId

int pocketmine\entity\Entity::$ownerId = null
protected

Definition at line 178 of file Entity.php.

◆ $scale

float pocketmine\entity\Entity::$scale = 1.0
protected

Definition at line 170 of file Entity.php.

◆ $scoreTag

string pocketmine\entity\Entity::$scoreTag = ""
protected

Definition at line 169 of file Entity.php.

◆ $server

Server pocketmine\entity\Entity::$server
protected

Definition at line 156 of file Entity.php.

◆ $silent

bool pocketmine\entity\Entity::$silent = false
protected

Definition at line 176 of file Entity.php.

◆ $size

EntitySizeInfo pocketmine\entity\Entity::$size

Definition at line 127 of file Entity.php.

◆ $stepHeight

float pocketmine\entity\Entity::$stepHeight = 0.0
protected

Definition at line 133 of file Entity.php.

◆ $targetId

int pocketmine\entity\Entity::$targetId = null
protected

Definition at line 179 of file Entity.php.

◆ $ticksLived

int pocketmine\entity\Entity::$ticksLived = 0

Definition at line 137 of file Entity.php.

◆ $timings

TimingsHandler pocketmine\entity\Entity::$timings
protected

Definition at line 162 of file Entity.php.

◆ $ySize

float pocketmine\entity\Entity::$ySize = 0.0
protected

Definition at line 132 of file Entity.php.

◆ MOTION_THRESHOLD

const pocketmine\entity\Entity::MOTION_THRESHOLD = 0.00001

Definition at line 84 of file Entity.php.

◆ STEP_CLIP_MULTIPLIER

const pocketmine\entity\Entity::STEP_CLIP_MULTIPLIER = 0.4
protected

Definition at line 85 of file Entity.php.

◆ TAG_MOTION

const pocketmine\entity\Entity::TAG_MOTION = "Motion"

Definition at line 93 of file Entity.php.

◆ TAG_POS

const pocketmine\entity\Entity::TAG_POS = "Pos"

Definition at line 92 of file Entity.php.

◆ TAG_ROTATION

const pocketmine\entity\Entity::TAG_ROTATION = "Rotation"

Definition at line 94 of file Entity.php.


The documentation for this class was generated from the following file: