Skip to content

Living ​

abstract class · pocketmine\entity\Living · source

Extends Entity

Constants ​

DEFAULT_BREATH_TICKS protected ​

php
protected const DEFAULT_BREATH_TICKS = 300

DEFAULT_KNOCKBACK_FORCE ​

php
public const DEFAULT_KNOCKBACK_FORCE = 0.4

The default knockback multiplier when an entity is hit by another entity. Larger values knock the entity back with increased velocity.

DEFAULT_KNOCKBACK_VERTICAL_LIMIT ​

php
public const DEFAULT_KNOCKBACK_VERTICAL_LIMIT = 0.4

Limit of an entity's vertical knockback velocity when hit by another entity. Without this limit, the entity may be knocked far up into the air with large knockback forces.

FREEZE_TICKS 5.46.0 ​

php
public const FREEZE_TICKS = 140

Ticks in powder snow to freeze completely (vanilla getTicksRequiredToFreeze()).

Properties ​

$absorptionAttr protected ​

php
protected \pocketmine\entity\Attribute $absorptionAttr

$armorInventory protected ​

php
protected \pocketmine\inventory\ArmorInventory $armorInventory

$attackTime protected ​

php
protected int $attackTime

$breathTicks protected ​

php
protected int $breathTicks

$breathing protected ​

php
protected bool $breathing

$deadTicks ​

php
public int $deadTicks

$effectManager protected ​

php
protected \pocketmine\entity\effect\EffectManager $effectManager

$fallDamageCutoffY 5.46.0 protected ​

php
protected ?float $fallDamageCutoffY

Fall distance above this Y doesn't count (set when launched by a wind charge), or null.

$gliding protected ​

php
protected bool $gliding

$healthAttr protected ​

php
protected \pocketmine\entity\Attribute $healthAttr

$jumpVelocity protected ​

php
protected float $jumpVelocity

$knockbackResistanceAttr protected ​

php
protected \pocketmine\entity\Attribute $knockbackResistanceAttr

$maxBreathTicks protected ​

php
protected int $maxBreathTicks

$maxDeadTicks protected ​

php
protected int $maxDeadTicks

$moveSpeedAttr protected ​

php
protected \pocketmine\entity\Attribute $moveSpeedAttr

$sneaking protected ​

php
protected bool $sneaking

$sprinting protected ​

php
protected bool $sprinting

$swimming protected ​

php
protected bool $swimming

$ticksFrozen 5.46.0 protected ​

php
protected int $ticksFrozen

Methods ​

addAttributes() protected ​

php
protected function addAttributes() : void

applyConsumptionResults() protected ​

php
protected function applyConsumptionResults(\pocketmine\entity\Consumable $consumable) : void

Applies effects from consuming the object. This shouldn't do any can-consume checks (those are expected to be handled by the caller).

applyDamageModifiers() ​

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

Called prior to EntityDamageEvent execution to apply modifications to the event's damage, such as reduction due to effects or armour.

applyEffectsOnDeath() 5.46.0 protected ​

php
protected function applyEffectsOnDeath() : void

Lets the active effects act on the death of this entity (Wind Charged, Weaving...).

applyFrostWalker() protected ​

php
protected function applyFrostWalker(int $level) : void

applyPostDamageEffects() protected ​

php
protected function applyPostDamageEffects(\pocketmine\event\entity\EntityDamageEvent $source) : void

Called after EntityDamageEvent execution to apply post-hurt effects, such as reducing absorption or modifying armour durability. This will not be called by damage sources causing death.

attack() ​

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

calculateFallDamage() protected ​

php
protected function calculateFallDamage(float $fallDistance) : float

canBeRenamed() ​

php
public function canBeRenamed() : bool

canBreathe() ​

php
public function canBreathe() : bool

Returns whether the entity can currently breathe.

canFreeze() 5.46.0 ​

php
public function canFreeze() : bool

Whether powder snow freezes this entity: not while it wears any leather armor piece (vanilla).

consumeObject() ​

php
public function consumeObject(\pocketmine\entity\Consumable $consumable) : bool

Causes the mob to consume the given Consumable object, applying applicable effects, health bonuses, food bonuses, etc.

damageArmor() ​

php
public function damageArmor(float $damage) : void

Damages the worn armour according to the amount of damage given. Each 4 points (rounded down) deals 1 damage point to each armour piece, but never less than 1 total.

destroyCycles() protected ​

php
protected function destroyCycles() : void

doAirSupplyTick() protected ​

php
protected function doAirSupplyTick(int $tickDiff) : bool

Ticks the entity's air supply, consuming it when underwater and regenerating it when out of water.

doFreezeTick() 5.46.0 protected ​

php
protected function doFreezeTick(int $tickDiff) : bool

Vanilla freezing: inside powder snow the frozen time grows by 1 per tick up to 140 ticks, outside it drops by 2 per tick. Fully frozen entities take freeze damage every 40 ticks. Clients show the frost overlay and the shivering from FREEZING_EFFECT_STRENGTH.

doHitAnimation() protected ​

php
protected function doHitAnimation() : void

endDeathAnimation() protected ​

php
protected function endDeathAnimation() : void

entityBaseTick() protected ​

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

getAbsorption() ​

php
public function getAbsorption() : float

getAirSupplyTicks() ​

php
public function getAirSupplyTicks() : int

Returns the number of ticks remaining in the entity's air supply. Note that the entity may survive longer than this amount of time without damage due to enchantments such as Respiration.

getArmorInventory() ​

php
public function getArmorInventory() : \pocketmine\inventory\ArmorInventory

getArmorPoints() ​

php
public function getArmorPoints() : int

Returns how many armour points this mob has. Armour points provide a percentage reduction to damage. For mobs which can wear armour, this should return the sum total of the armour points provided by their equipment.

getDisplayName() ​

php
public function getDisplayName() : string

Returns the name used to describe this entity in chat and command outputs.

getDrops() ​

php
public function getDrops() : array

getEffects() ​

php
public function getEffects() : \pocketmine\entity\effect\EffectManager

getFallDamageCutoffY() 5.46.0 ​

php
public function getFallDamageCutoffY() : ?float

getFreezeDamage() 5.46.0 protected ​

php
protected function getFreezeDamage() : float

Damage taken every 2 seconds while fully frozen (vanilla: 5 for blazes, magma cubes and striders).

getFrostWalkerLevel() ​

php
public function getFrostWalkerLevel() : int

getHighestArmorEnchantmentLevel() ​

php
public function getHighestArmorEnchantmentLevel(\pocketmine\item\enchantment\Enchantment $enchantment) : int

Returns the highest level of the specified enchantment on any armour piece that the entity is currently wearing.

getInitialDragMultiplier() protected ​

php
protected function getInitialDragMultiplier() : float

getInitialGravity() protected ​

php
protected function getInitialGravity() : float

getJumpVelocity() ​

php
public function getJumpVelocity() : float

Returns the initial upwards velocity of a jumping entity in blocks/tick, including additional velocity due to effects.

getLineOfSight() ​

php
public function getLineOfSight(int $maxDistance, int $maxLength = 0, array $transparent = []) : array

getMaxAirSupplyTicks() ​

php
public function getMaxAirSupplyTicks() : int

Returns the maximum amount of air ticks the entity's air supply can contain.

getMaxHealth() ​

php
public function getMaxHealth() : int

getMovementSpeed() ​

php
public function getMovementSpeed() : float

getName() ​

php
abstract public function getName() : string

getSneakOffset() ​

php
public function getSneakOffset() : float

getSpawnReason() 5.46.0 ​

php
public function getSpawnReason() : string

Returns why this mob came into the world (like Paper's Entity::getEntitySpawnReason()): one of the SpawnReason constants, or a plugin's own reason. Saved with the mob.

getTargetBlock() ​

php
public function getTargetBlock(int $maxDistance, array $transparent = []) : ?\pocketmine\block\Block

getTicksFrozen() 5.46.0 ​

php
public function getTicksFrozen() : int

Ticks spent freezing, from 0 to Living::FREEZE_TICKS (fully frozen).

getXpDropAmount() ​

php
public function getXpDropAmount() : int

Returns the amount of XP this mob will drop on death.

initEntity() protected ​

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

isBreathing() ​

php
public function isBreathing() : bool

Returns whether the entity is currently breathing or not. If this is false, the entity's air supply will be used.

isEyeInBubbleColumn() 5.46.0 protected ​

php
protected function isEyeInBubbleColumn() : bool

Whether the entity's eyes are in a bubble column, where air-breathing mobs and players get their air back as if they were out of the water (vanilla).

isGliding() ​

php
public function isGliding() : bool

isSneaking() ​

php
public function isSneaking() : bool

isSprinting() ​

php
public function isSprinting() : bool

isSwimming() ​

php
public function isSwimming() : bool

jump() ​

php
public function jump() : void

Called when the entity jumps from the ground. This method adds upwards velocity to the entity.

knockBack() ​

php
public function knockBack(float $x, float $z, float $force = self::DEFAULT_KNOCKBACK_FORCE, ?float $verticalLimit = self::DEFAULT_KNOCKBACK_VERTICAL_LIMIT) : void

lookAt() ​

php
public function lookAt(\pocketmine\math\Vector3 $target) : void

Changes the entity's yaw and pitch to make it look at the specified Vector3 position. For mobs, this will cause their heads to turn.

move() protected ​

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

onAirExpired() ​

php
public function onAirExpired() : void

Called when the entity's air supply ticks reaches -20 or lower. The entity will usually take damage at this point and then the supply is reset to 0, so this method will be called roughly every second.

onDeath() protected ​

php
protected function onDeath() : void

onDeathUpdate() protected ​

php
protected function onDeathUpdate(int $tickDiff) : bool

onDispose() protected ​

php
protected function onDispose() : void

onHitGround() protected ​

php
protected function onHitGround() : ?float

saveNBT() ​

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

sendSpawnPacket() protected ​

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

setAbsorption() ​

php
public function setAbsorption(float $absorption) : void

setAirSupplyTicks() ​

php
public function setAirSupplyTicks(int $ticks) : void

Sets the number of air ticks left in the entity's air supply.

setBreathing() ​

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

Sets whether the entity is currently breathing. If false, it will cause the entity's air supply to be used. For players, this also shows the oxygen bar.

setFallDamageCutoffY() 5.46.0 ​

php
public function setFallDamageCutoffY(?float $y) : void

Makes the entity take fall damage only for the distance it falls below the given Y, until it next lands. Used by wind charges, whose bursts negate the fall damage of the launched entities (vanilla).

setGliding() ​

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

setHealth() ​

php
public function setHealth(float $amount) : void

setInPowderSnow() 5.46.0 ​

php
public function setInPowderSnow() : void

Called by powder snow for entities inside it, every tick (see Living::doFreezeTick()).

setMaxAirSupplyTicks() ​

php
public function setMaxAirSupplyTicks(int $ticks) : void

Sets the maximum amount of air ticks the air supply can hold.

setMaxHealth() ​

php
public function setMaxHealth(int $amount) : void

setMovementSpeed() ​

php
public function setMovementSpeed(float $v, bool $fit = false) : void

setOnFire() ​

php
public function setOnFire(int $seconds) : void

setSneaking() ​

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

setSpawnReason() 5.46.0 ​

php
public function setSpawnReason(string $reason) : void

setSprinting() ​

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

setSwimming() ​

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

setTicksFrozen() 5.46.0 ​

php
public function setTicksFrozen(int $ticks) : void

startDeathAnimation() protected ​

php
protected function startDeathAnimation() : void

syncNetworkData() protected ​

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

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