Skip to content

Entity ​

abstract class · pocketmine\entity\Entity · source

Constants ​

BLOCK_FLAG_BUBBLE_COLUMN 5.46.0 protected ​

php
protected const BLOCK_FLAG_BUBBLE_COLUMN = 4

BLOCK_FLAG_POWDER_SNOW 5.46.0 protected ​

php
protected const BLOCK_FLAG_POWDER_SNOW = 8

BLOCK_FLAG_SOLID_OPAQUE 5.46.0 protected ​

php
protected const BLOCK_FLAG_SOLID_OPAQUE = 1

BLOCK_FLAG_WATER 5.46.0 protected ​

php
protected const BLOCK_FLAG_WATER = 2

MAX_COMMAND_TAGS 5.46.0 ​

php
public const MAX_COMMAND_TAGS = 1024

Most tags an entity can have (/tag add fails beyond this, like Bedrock).

MOTION_THRESHOLD ​

php
public const MOTION_THRESHOLD = 1.0E-5

SEATED_EYE_HEIGHT_FACTOR 5.46.0 protected ​

php
protected const SEATED_EYE_HEIGHT_FACTOR = 0.75308642

Vertical offset of a passenger's position from its seat sent to clients: players are placed with their eyes (their network position) at 0.753 of their standing eye height above the seat, mobs with their feet a quarter of their height below it (same values as PowerNukkitX, which match vanilla).

STEP_CLIP_MULTIPLIER protected ​

php
protected const STEP_CLIP_MULTIPLIER = 0.4
php
public const TAG_LINKS = "LinksTag"
php
public const TAG_LINK_ENTITY_ID = "entityID"
php
public const TAG_LINK_ID = "linkID"

TAG_MOTION ​

php
public const TAG_MOTION = "Motion"

TAG_POS ​

php
public const TAG_POS = "Pos"

TAG_ROTATION ​

php
public const TAG_ROTATION = "Rotation"

TAG_UNIQUE_ID 5.46.0 ​

php
public const TAG_UNIQUE_ID = "UniqueID"

Properties ​

$alwaysShowNameTag protected ​

php
protected bool $alwaysShowNameTag

$attributeMap protected ​

php
protected \pocketmine\entity\AttributeMap $attributeMap

$blocksAround protected ​

php
protected ?array $blocksAround

$boundingBox ​

php
public \pocketmine\math\AxisAlignedBB $boundingBox

$canClimb protected ​

php
protected bool $canClimb

$canClimbWalls protected ​

php
protected bool $canClimbWalls

$closed protected ​

php
protected bool $closed

$drag protected ​

php
protected float $drag

$fallDistance ​

php
public float $fallDistance

$fireTicks protected ​

php
protected int $fireTicks

$forceMovementUpdate protected ​

php
protected bool $forceMovementUpdate

$gravity protected ​

php
protected float $gravity

$gravityEnabled protected ​

php
protected bool $gravityEnabled

$hasSpawned protected ​

php
protected array $hasSpawned

$id protected ​

php
protected int $id

$invisible protected ​

php
protected bool $invisible

$isCollided ​

php
public bool $isCollided

$isCollidedHorizontally ​

php
public bool $isCollidedHorizontally

$isCollidedVertically ​

php
public bool $isCollidedVertically

$justCreated protected ​

php
protected bool $justCreated

$keepMovement ​

php
public bool $keepMovement

$lastDamageCause protected ​

php
protected ?\pocketmine\event\entity\EntityDamageEvent $lastDamageCause

$lastLocation protected ​

php
protected \pocketmine\entity\Location $lastLocation

$lastMotion protected ​

php
protected \pocketmine\math\Vector3 $lastMotion

$lastUpdate ​

php
public int $lastUpdate

$location protected ​

php
protected \pocketmine\entity\Location $location

$motion protected ​

php
protected \pocketmine\math\Vector3 $motion

$nameTag protected ​

php
protected string $nameTag

$nameTagVisible protected ​

php
protected bool $nameTagVisible

$networkPropertiesDirty protected ​

php
protected bool $networkPropertiesDirty

$noClientPredictions protected ​

php
protected bool $noClientPredictions

$noDamageTicks ​

php
public int $noDamageTicks

$onGround ​

php
public bool $onGround

$ownerId protected ​

php
protected ?int $ownerId

$passengers 5.46.0 protected ​

php
protected array $passengers

Entities riding this one, by seat. The first one is the rider (it may control the vehicle).

$scale protected ​

php
protected float $scale

$scoreTag protected ​

php
protected string $scoreTag

$server protected ​

php
protected \pocketmine\Server $server

$silent protected ​

php
protected bool $silent

$size ​

php
public \pocketmine\entity\EntitySizeInfo $size

$stepHeight protected ​

php
protected float $stepHeight

$targetId protected ​

php
protected ?int $targetId

$ticksLived ​

php
public int $ticksLived

$timings protected ​

php
protected \pocketmine\timings\TimingsHandler $timings

$vehicle 5.46.0 protected ​

php
protected ?\pocketmine\entity\Entity $vehicle

The entity this entity is riding.

$viewerSendIds 5.46.0 protected ​

php
protected array $viewerSendIds

$ySize protected ​

php
protected float $ySize

Methods ​

__construct() ​

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

__destruct() ​

php
public function __destruct()

__toString() ​

php
public function __toString()

addAttributes() protected ​

php
protected function addAttributes() : void

addCommandTag() 5.46.0 ​

php
public function addCommandTag(string $tag) : bool

Adds a command tag. Returns false if the entity already has it, the tag is empty, or the entity has MAX_COMMAND_TAGS tags.

addMotion() ​

php
public function addMotion(float $x, float $y, float $z) : void

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

applyDragBeforeGravity() protected ​

php
protected function applyDragBeforeGravity() : bool

attack() ​

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

blockFlagsAt() 5.46.0 protected ​

php
protected static function blockFlagsAt(\pocketmine\world\World $world, int $x, int $y, int $z) : int

Returns the BLOCK_FLAG_* of the block at the given position (0 outside the world and in unloaded chunks, like the air World::getBlockAt() returns there), without building the block.

broadcastAnimation() ​

php
public function broadcastAnimation(\pocketmine\entity\animation\Animation $animation, ?array $targets = null) : void

broadcastMotion() protected ​

php
protected function broadcastMotion() : void

broadcastMovement() protected ​

php
protected function broadcastMovement(bool $teleport = false) : void

broadcastSound() ​

php
public function broadcastSound(\pocketmine\world\sound\Sound $sound, ?array $targets = null) : void

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

canAddPassenger() 5.46.0 ​

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

Returns whether the given entity may get on this one now: it is allowed to ride it and a seat is free.

canBeCollidedWith() ​

php
public function canBeCollidedWith() : bool

canBeMovedByCurrents() ​

php
public function canBeMovedByCurrents() : bool

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

canBeRenamed() ​

php
public function canBeRenamed() : bool

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

canBeRiddenBy() 5.46.0 ​

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

Returns whether the given entity may ride this one (the vanilla "family_types" of the rideable component, a saddle...). Free seats are checked by Entity::canAddPassenger().

canBeStoodOn() 5.46.0 ​

php
public function canBeStoodOn() : bool

Returns whether players can stand on top of this entity as if it was a block (Bedrock is_collidable, shown to clients with the COLLIDABLE metadata flag). Players standing on it are on the ground: their falls end there.

canClimb() ​

php
public function canClimb() : bool

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

canClimbWalls() ​

php
public function 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() ​

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

canSaveWithChunk() ​

php
public function canSaveWithChunk() : bool

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

checkBlockIntersections() protected ​

php
protected function checkBlockIntersections() : void

checkGroundState() protected ​

php
protected function checkGroundState(float $wantedX, float $wantedY, float $wantedZ, float $dx, float $dy, float $dz) : void

checkObstruction() protected ​

php
protected function checkObstruction(float $x, float $y, float $z) : bool

close() ​

php
final public function close() : void

Closes the entity and frees attached references.

WARNING: Entities are unusable after this has been executed!

createMovementPacket() 5.46.0 protected ​

php
protected function createMovementPacket() : \pocketmine\network\mcpe\protocol\MoveActorAbsolutePacket

dealFireDamage() protected ​

php
protected function dealFireDamage() : void

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

despawnFrom() ​

php
public function despawnFrom(\pocketmine\player\Player $player, bool $send = true) : void

Deprecated

WARNING: This function DOES NOT permanently hide the entity from the player. As soon as the entity or

despawnFromAll() ​

php
public function despawnFromAll() : void

Deprecated

WARNING: This function DOES NOT permanently hide the entity from viewers. As soon as the entity or

destroyCycles() protected ​

php
protected function 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.

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

dismount() 5.46.0 ​

php
public function dismount(bool $force = false, bool $causedByRider = false) : bool

Gets this entity off its vehicle, beside it. Unless forced, the EntityDismountEvent may refuse it. Returns whether the entity got off.

doOnFireTick() protected ​

php
protected function doOnFireTick(int $tickDiff = 1) : bool

ejectPassengers() 5.46.0 ​

php
public function ejectPassengers(bool $reposition = true) : void

Gets every passenger off this entity (forced dismounts).

entityBaseTick() protected ​

php
protected function entityBaseTick(int $tickDiff = 1) : bool

extinguish() ​

php
public function extinguish(int $cause = \pocketmine\event\entity\EntityExtinguishEvent::CAUSE_CUSTOM) : void

flagForDespawn() ​

php
public function flagForDespawn() : void

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

getAllNetworkData() protected ​

php
final protected function getAllNetworkData() : array

getAttributeMap() ​

php
public function getAttributeMap() : \pocketmine\entity\AttributeMap

getBlocksAroundWithEntityInsideActions() protected ​

php
protected function getBlocksAroundWithEntityInsideActions() : array

getBlocksIntersected() protected ​

php
protected function getBlocksIntersected(float $inset) : \Generator

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

getBoundingBox() ​

php
public function getBoundingBox() : \pocketmine\math\AxisAlignedBB

getCommandTags() 5.46.0 ​

php
public function getCommandTags() : array

Returns the command tags of this entity (Bedrock /tag; selected with @e[tag=...]). They are saved with the entity.

getControllingPassenger() 5.46.0 ​

php
public function getControllingPassenger() : ?\pocketmine\entity\Entity

Returns the passenger on the first seat, which controls the vehicle if it can, or null.

getDirectionPlane() ​

php
public function getDirectionPlane() : \pocketmine\math\Vector2

getDirectionVector() ​

php
public function getDirectionVector() : \pocketmine\math\Vector3

getDirtyNetworkData() protected ​

php
final protected function getDirtyNetworkData() : array

getDismountPosition() 5.46.0 ​

php
public function getDismountPosition(\pocketmine\entity\Entity $passenger) : \pocketmine\math\Vector3

Returns where a passenger is put when it gets off: the first free spot with ground beside this entity (left, right, back, front), or on top of it.

getEyeHeight() ​

php
public function getEyeHeight() : float

getEyePos() ​

php
public function getEyePos() : \pocketmine\math\Vector3

getFallDistance() ​

php
public function getFallDistance() : float

getFireTicks() ​

php
public function getFireTicks() : int

getGravity() ​

php
public function getGravity() : float

getHeadYaw() 5.46.0 ​

php
public function getHeadYaw() : float

Returns the yaw of the entity's head sent to clients. Only mobs turn their head independently of their body.

getHealth() ​

php
public function getHealth() : float

getHorizontalFacing() ​

php
public function getHorizontalFacing() : int

getId() ​

php
public function getId() : int

getInitialDragMultiplier() protected ​

php
abstract protected function getInitialDragMultiplier() : float

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.

getInitialGravity() protected ​

php
abstract protected function getInitialGravity() : float

Returns the downwards acceleration of the entity when falling, in blocks/tick².

getInitialSizeInfo() protected ​

php
abstract protected function getInitialSizeInfo() : \pocketmine\entity\EntitySizeInfo

getInteractButtonText() 5.46.0 ​

php
public function getInteractButtonText(\pocketmine\player\Player $player) : string

Returns the text of the interaction button shown to a touch player pointing at this entity (vanilla interact_text, e.g. "action.interact.ride.horse"), or "" for none.

getLastDamageCause() ​

php
public function getLastDamageCause() : ?\pocketmine\event\entity\EntityDamageEvent

getLocation() ​

php
public function getLocation() : \pocketmine\entity\Location

getMaxHealth() ​

php
public function getMaxHealth() : int

getMotion() ​

php
public function getMotion() : \pocketmine\math\Vector3

getNameTag() ​

php
public function getNameTag() : string

getNetworkProperties() ​

php
public function getNetworkProperties() : \pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection

getNetworkSyncedProperties() 5.46.0 ​

php
public function getNetworkSyncedProperties() : \pocketmine\network\mcpe\protocol\types\entity\PropertySyncData

Returns the actor property values sent to clients with the entity's metadata (see \pocketmine\entity\property\EntityPropertyRegistry). Most entities have none.

getNetworkTypeId() ​

php
abstract public static function getNetworkTypeId() : string

getOffsetPosition() ​

php
public function getOffsetPosition(\pocketmine\math\Vector3 $vector3) : \pocketmine\math\Vector3

getOwningEntity() ​

php
public function getOwningEntity() : ?\pocketmine\entity\Entity

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

getOwningEntityId() ​

php
public function getOwningEntityId() : ?int

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

getPassengerPosition() 5.46.0 ​

php
public function getPassengerPosition(\pocketmine\entity\Entity $passenger) : \pocketmine\math\Vector3

Returns where a passenger of this entity is in the world (its feet): its seat offset rotated by this entity's yaw.

getPassengerSeatOffset() 5.46.0 ​

php
public function getPassengerSeatOffset(\pocketmine\entity\Entity $passenger) : \pocketmine\math\Vector3

Returns the position of a passenger relative to this entity, as sent to clients (RIDER_SEAT_POSITION): its seat (before rotating by the vehicle's yaw) raised by the passenger's Entity::getSeatedHeightOffset().

getPassengers() 5.46.0 ​

php
public function getPassengers() : array

Returns the entities riding this one, by seat (the first one is the rider).

getPersistentUniqueId() 5.46.0 ​

php
public function getPersistentUniqueId() : int

Returns the persistent ID of this entity (vanilla "UniqueID"), assigning a random one the first time. It is only saved once assigned, which happens to the vehicles and passengers of saved links (see Entity::mount()).

getPickedItem() ​

php
public function getPickedItem() : ?\pocketmine\item\Item

Returns the item that players will equip when middle-clicking on this entity.

getPosition() ​

php
public function getPosition() : \pocketmine\world\Position

getRideableSeats() 5.46.0 ​

php
public function getRideableSeats() : array

Returns the seats of this entity in its current state (vanilla minecraft:rideable component), by seat order. An entity with no seats can't be ridden.

getScale() ​

php
public function getScale() : float

getScoreTag() ​

php
public function getScoreTag() : ?string

getSeatOf() 5.46.0 ​

php
public function getSeatOf(\pocketmine\entity\Entity $passenger) : ?\pocketmine\entity\riding\RideableSeat

Returns the seat of a passenger of this entity, or null if it isn't one.

getSeatedHeightOffset() 5.46.0 ​

php
public function getSeatedHeightOffset() : float

Returns the height of this entity's network position above its seat when riding something: mobs have their feet a quarter of their height below the seat (players override this).

getSize() ​

php
public function getSize() : \pocketmine\entity\EntitySizeInfo
php
protected function getSpawnLinks(\pocketmine\player\Player $player) : array

Returns the links to this entity's passengers that the given player already sees, sent with the spawn packet. Passengers spawned later send their own link (see Entity::spawnTo()).

getStepHeight() ​

php
public function getStepHeight() : float

getTargetEntity() ​

php
public function getTargetEntity() : ?\pocketmine\entity\Entity

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.

getTargetEntityId() ​

php
public function getTargetEntityId() : ?int

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

getVehicle() 5.46.0 ​

php
public function getVehicle() : ?\pocketmine\entity\Entity

Returns the entity this entity is riding, if any.

getViewers() ​

php
public function getViewers() : array

getWorld() ​

php
public function getWorld() : \pocketmine\world\World

givesUnderwaterBreathingTo() 5.46.0 ​

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

Returns whether the given passenger of this entity can breathe underwater while riding it (vanilla underwater_mount_breathing, e.g. a saddled nautilus in water).

handleClientVehicleMovement() 5.46.0 ​

php
public function handleClientVehicleMovement(\pocketmine\player\Player $rider, \pocketmine\math\Vector3 $pos, float $yaw, float $pitch) : bool

Called when the client of the rider moved this vehicle itself (client-predicted vehicles like horses), with the vehicle's new position (feet) and rotation. Returns false if the movement was refused; the vehicle is then sent back to its position.

handleRiderInput() 5.46.0 ​

php
public function handleRiderInput(\pocketmine\player\Player $rider, \pocketmine\entity\riding\RiderInput $input) : void

Called every tick with the input of the player controlling this vehicle (its rider). Vehicles steered by their rider override this.

hasCommandTag() 5.46.0 ​

php
public function hasCommandTag(string $tag) : bool

hasGravity() ​

php
public function hasGravity() : bool

hasMovementUpdate() ​

php
public function hasMovementUpdate() : bool

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

hasNoClientPredictions() ​

php
public function hasNoClientPredictions() : bool

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

hasPassenger() 5.46.0 ​

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

heal() ​

php
public function heal(\pocketmine\event\entity\EntityRegainHealthEvent $source) : void

initEntity() protected ​

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

isAlive() ​

php
public function isAlive() : bool

isClosed() ​

php
public function isClosed() : bool

Returns whether the entity has been "closed".

isFireProof() ​

php
public function isFireProof() : bool

isFlaggedForDespawn() ​

php
public function isFlaggedForDespawn() : bool

isInRain() 5.46.0 ​

php
public function isInRain() : bool

Returns whether rain falls on the entity: it rains in the world and rain (not snow) reaches its feet or the top of its bounding box under the open sky (see \pocketmine\world\weather\Weather::isRainingAt()).

isInsideOfSolid() ​

php
public function isInsideOfSolid() : bool

isInvisible() ​

php
public function isInvisible() : bool

isNameTagAlwaysVisible() ​

php
public function isNameTagAlwaysVisible() : bool

isNameTagVisible() ​

php
public function isNameTagVisible() : bool

isOnFire() ​

php
public function isOnFire() : bool

isOnGround() ​

php
public function isOnGround() : bool

isRiding() 5.46.0 ​

php
public function isRiding() : bool

isSilent() ​

php
public function isSilent() : bool

isUnderwater() ​

php
public function isUnderwater() : bool

kill() ​

php
public function kill() : void

mount() 5.46.0 ​

php
public function mount(\pocketmine\entity\Entity $vehicle, bool $causedByRider = false) : bool

Makes this entity ride the given vehicle, on its first free seat. Fails if the vehicle has no free seat this entity may take, or if the EntityMountEvent is cancelled. An entity riding something else gets off it first.

move() protected ​

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

movePassengerToFront() 5.46.0 protected ​

php
protected function movePassengerToFront(\pocketmine\entity\Entity $passenger) : void

Moves a passenger to the first seat (e.g. a player getting in a boat a mob sits in: the player steers it); the passengers before it move back a seat. Clients get the new links and seats at once.

nextRuntimeId() ​

php
public static function nextRuntimeId() : int

Returns a new runtime entity ID for a new entity.

onCollideWithPlayer() ​

php
public function onCollideWithPlayer(\pocketmine\player\Player $player) : void

onDeath() protected ​

php
protected function onDeath() : void

Override this to do actions on death.

onDeathUpdate() protected ​

php
protected function onDeathUpdate(int $tickDiff) : bool

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

onDismount() 5.46.0 protected ​

php
protected function onDismount(\pocketmine\entity\Entity $vehicle) : void

Called when this entity got off its vehicle.

onDispose() protected ​

php
protected function 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.

onFirstUpdate() protected ​

php
protected function onFirstUpdate(int $currentTick) : void

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.

onFrozenUpdate() 5.46.0 ​

php
public function onFrozenUpdate(int $currentTick) : bool

Called by the world instead of onUpdate() while the entity is beyond the simulation distance of every player (see World::getSimulationDistance()): as in vanilla, it stays loaded and visible but doesn't move or act, and its own clock doesn't advance (the next onUpdate() sees a tick difference of 1). A new entity still gets its first update (spawn event, passenger links) at once.

onHitGround() protected ​

php
protected function onHitGround() : ?float

Called when a falling entity hits the ground.

onInteract() ​

php
public function onInteract(\pocketmine\player\Player $player, \pocketmine\math\Vector3 $clickPos) : bool

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

onMount() 5.46.0 protected ​

php
protected function onMount(\pocketmine\entity\Entity $vehicle) : void

Called when this entity got on a vehicle.

onNearbyBlockChange() ​

php
public function onNearbyBlockChange() : void

onPassengerAdded() 5.46.0 protected ​

php
protected function onPassengerAdded(\pocketmine\entity\Entity $passenger) : void

Called when an entity got on this one.

onPassengerRemoved() 5.46.0 protected ​

php
protected function onPassengerRemoved(\pocketmine\entity\Entity $passenger) : void

Called when a passenger got off this entity.

onRandomUpdate() ​

php
public function 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).

onStruckByLightning() 5.46.0 ​

php
public function onStruckByLightning(\pocketmine\entity\object\LightningBolt $bolt) : void

Called when a lightning bolt strikes the entity (once per bolt). Vanilla: 8 seconds of fire and 5 damage. Mobs that change when struck (pigs, villagers, creepers, mooshrooms...) override this.

onUpdate() ​

php
public function onUpdate(int $currentTick) : bool

positionPassengers() 5.46.0 protected ​

php
protected function positionPassengers() : void

Moves the passengers onto their seats. Called after this entity moved, every tick.

recalculateBoundingBox() protected ​

php
protected function recalculateBoundingBox() : void

refreshPassengerSeats() 5.46.0 protected ​

php
protected function refreshPassengerSeats() : void

Sends the seats of all the passengers again, for vehicles whose seats depend on how many passengers they carry (boats).

removeCommandTag() 5.46.0 ​

php
public function removeCommandTag(string $tag) : bool

Removes a command tag. Returns false if the entity did not have it.

resetFallDistance() ​

php
public function resetFallDistance() : void

resetLastMovements() protected ​

php
protected function resetLastMovements() : void

respawnToAll() ​

php
public function respawnToAll() : void

saveNBT() ​

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

scheduleUpdate() ​

php
final public function scheduleUpdate() : void

sendData() ​

php
public function sendData(?array $targets, ?array $data = null) : void

sendSpawnPacket() protected ​

php
protected function sendSpawnPacket(\pocketmine\player\Player $player) : void

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

setCanClimb() ​

php
public function setCanClimb(bool $value = true) : void

Sets whether the entity is able to climb climbable blocks.

setCanClimbWalls() ​

php
public function setCanClimbWalls(bool $value = true) : void

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

setCanSaveWithChunk() ​

php
public function setCanSaveWithChunk(bool $value) : 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.

setFallDistance() ​

php
public function setFallDistance(float $fallDistance) : void

setFireTicks() ​

php
public function setFireTicks(int $fireTicks) : void

setForceMovementUpdate() ​

php
final public function setForceMovementUpdate(bool $value = true) : 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.

setGravity() ​

php
public function setGravity(float $gravity) : void

setHasGravity() ​

php
public function setHasGravity(bool $v = true) : void

setHealth() ​

php
public function setHealth(float $amount) : void

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

setInvisible() ​

php
public function setInvisible(bool $value = true) : void

setLastDamageCause() ​

php
public function setLastDamageCause(\pocketmine\event\entity\EntityDamageEvent $type) : void

setMaxHealth() ​

php
public function setMaxHealth(int $amount) : void

setMotion() ​

php
public function setMotion(\pocketmine\math\Vector3 $motion) : bool

setNameTag() ​

php
public function setNameTag(string $name) : void

setNameTagAlwaysVisible() ​

php
public function setNameTagAlwaysVisible(bool $value = true) : void

setNameTagVisible() ​

php
public function setNameTagVisible(bool $value = true) : void

setNoClientPredictions() ​

php
public function setNoClientPredictions(bool $value = true) : void

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.

setOnFire() ​

php
public function setOnFire(int $seconds) : void

setOwningEntity() ​

php
public function setOwningEntity(?\pocketmine\entity\Entity $owner) : void

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

setPosition() protected ​

php
protected function setPosition(\pocketmine\math\Vector3 $pos) : bool

setPositionAndRotation() protected ​

php
protected function setPositionAndRotation(\pocketmine\math\Vector3 $pos, float $yaw, float $pitch) : bool

setRotation() ​

php
public function setRotation(float $yaw, float $pitch) : void

setScale() ​

php
public function setScale(float $value) : void

setScoreTag() ​

php
public function setScoreTag(string $score) : void

setSilent() ​

php
public function setSilent(bool $value = true) : void

setSize() protected ​

php
protected function setSize(\pocketmine\entity\EntitySizeInfo $size) : void

setStepHeight() ​

php
public function setStepHeight(float $stepHeight) : void

setTargetEntity() ​

php
public function setTargetEntity(?\pocketmine\entity\Entity $target) : void

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

spawnTo() ​

php
public function spawnTo(\pocketmine\player\Player $player) : void

spawnToAll() ​

php
public function spawnToAll() : void

syncNetworkData() protected ​

php
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : void

teleport() ​

php
public function teleport(\pocketmine\math\Vector3 $pos, ?float $yaw = null, ?float $pitch = null) : bool

tryChangeMovement() protected ​

php
protected function tryChangeMovement() : void

updateFallState() protected ​

php
protected function updateFallState(float $distanceThisTick, bool $onGround) : ?float

updateMovement() protected ​

php
protected function updateMovement(bool $teleport = false) : void

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