Living
Extends Entity
Constants
DEFAULT_BREATH_TICKS protected
protected const DEFAULT_BREATH_TICKS = 300DEFAULT_KNOCKBACK_FORCE
public const DEFAULT_KNOCKBACK_FORCE = 0.4The default knockback multiplier when an entity is hit by another entity. Larger values knock the entity back with increased velocity.
DEFAULT_KNOCKBACK_VERTICAL_LIMIT
public const DEFAULT_KNOCKBACK_VERTICAL_LIMIT = 0.4Limit 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
public const FREEZE_TICKS = 140Ticks in powder snow to freeze completely (vanilla getTicksRequiredToFreeze()).
Properties
$absorptionAttr protected
protected \pocketmine\entity\Attribute $absorptionAttr$armorInventory protected
protected \pocketmine\inventory\ArmorInventory $armorInventory$attackTime protected
protected int $attackTime$breathTicks protected
protected int $breathTicks$breathing protected
protected bool $breathing$deadTicks
public int $deadTicks$effectManager protected
protected \pocketmine\entity\effect\EffectManager $effectManager$fallDamageCutoffY 5.46.0 protected
protected ?float $fallDamageCutoffYFall distance above this Y doesn't count (set when launched by a wind charge), or null.
$gliding protected
protected bool $gliding$healthAttr protected
protected \pocketmine\entity\Attribute $healthAttr$jumpVelocity protected
protected float $jumpVelocity$knockbackResistanceAttr protected
protected \pocketmine\entity\Attribute $knockbackResistanceAttr$maxBreathTicks protected
protected int $maxBreathTicks$maxDeadTicks protected
protected int $maxDeadTicks$moveSpeedAttr protected
protected \pocketmine\entity\Attribute $moveSpeedAttr$sneaking protected
protected bool $sneaking$sprinting protected
protected bool $sprinting$swimming protected
protected bool $swimming$ticksFrozen 5.46.0 protected
protected int $ticksFrozenMethods
addAttributes() protected
protected function addAttributes() : voidapplyConsumptionResults() protected
protected function applyConsumptionResults(\pocketmine\entity\Consumable $consumable) : voidApplies effects from consuming the object. This shouldn't do any can-consume checks (those are expected to be handled by the caller).
applyDamageModifiers()
public function applyDamageModifiers(\pocketmine\event\entity\EntityDamageEvent $source) : voidCalled 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
protected function applyEffectsOnDeath() : voidLets the active effects act on the death of this entity (Wind Charged, Weaving...).
applyFrostWalker() protected
protected function applyFrostWalker(int $level) : voidapplyPostDamageEffects() protected
protected function applyPostDamageEffects(\pocketmine\event\entity\EntityDamageEvent $source) : voidCalled 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()
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : voidcalculateFallDamage() protected
protected function calculateFallDamage(float $fallDistance) : floatcanBeRenamed()
public function canBeRenamed() : boolcanBreathe()
public function canBreathe() : boolReturns whether the entity can currently breathe.
canFreeze() 5.46.0
public function canFreeze() : boolWhether powder snow freezes this entity: not while it wears any leather armor piece (vanilla).
consumeObject()
public function consumeObject(\pocketmine\entity\Consumable $consumable) : boolCauses the mob to consume the given Consumable object, applying applicable effects, health bonuses, food bonuses, etc.
damageArmor()
public function damageArmor(float $damage) : voidDamages 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
protected function destroyCycles() : voiddoAirSupplyTick() protected
protected function doAirSupplyTick(int $tickDiff) : boolTicks the entity's air supply, consuming it when underwater and regenerating it when out of water.
doFreezeTick() 5.46.0 protected
protected function doFreezeTick(int $tickDiff) : boolVanilla 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
protected function doHitAnimation() : voidendDeathAnimation() protected
protected function endDeathAnimation() : voidentityBaseTick() protected
protected function entityBaseTick(int $tickDiff = 1) : boolgetAbsorption()
public function getAbsorption() : floatgetAirSupplyTicks()
public function getAirSupplyTicks() : intReturns 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()
public function getArmorInventory() : \pocketmine\inventory\ArmorInventorygetArmorPoints()
public function getArmorPoints() : intReturns 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()
public function getDisplayName() : stringReturns the name used to describe this entity in chat and command outputs.
getDrops()
public function getDrops() : arraygetEffects()
public function getEffects() : \pocketmine\entity\effect\EffectManagergetFallDamageCutoffY() 5.46.0
public function getFallDamageCutoffY() : ?floatgetFreezeDamage() 5.46.0 protected
protected function getFreezeDamage() : floatDamage taken every 2 seconds while fully frozen (vanilla: 5 for blazes, magma cubes and striders).
getFrostWalkerLevel()
public function getFrostWalkerLevel() : intgetHighestArmorEnchantmentLevel()
public function getHighestArmorEnchantmentLevel(\pocketmine\item\enchantment\Enchantment $enchantment) : intReturns the highest level of the specified enchantment on any armour piece that the entity is currently wearing.
getInitialDragMultiplier() protected
protected function getInitialDragMultiplier() : floatgetInitialGravity() protected
protected function getInitialGravity() : floatgetJumpVelocity()
public function getJumpVelocity() : floatReturns the initial upwards velocity of a jumping entity in blocks/tick, including additional velocity due to effects.
getLineOfSight()
public function getLineOfSight(int $maxDistance, int $maxLength = 0, array $transparent = []) : arraygetMaxAirSupplyTicks()
public function getMaxAirSupplyTicks() : intReturns the maximum amount of air ticks the entity's air supply can contain.
getMaxHealth()
public function getMaxHealth() : intgetMovementSpeed()
public function getMovementSpeed() : floatgetName()
abstract public function getName() : stringgetSneakOffset()
public function getSneakOffset() : floatgetSpawnReason() 5.46.0
public function getSpawnReason() : stringReturns 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()
public function getTargetBlock(int $maxDistance, array $transparent = []) : ?\pocketmine\block\BlockgetTicksFrozen() 5.46.0
public function getTicksFrozen() : intTicks spent freezing, from 0 to Living::FREEZE_TICKS (fully frozen).
getXpDropAmount()
public function getXpDropAmount() : intReturns the amount of XP this mob will drop on death.
initEntity() protected
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : voidisBreathing()
public function isBreathing() : boolReturns 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
protected function isEyeInBubbleColumn() : boolWhether 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()
public function isGliding() : boolisSneaking()
public function isSneaking() : boolisSprinting()
public function isSprinting() : boolisSwimming()
public function isSwimming() : booljump()
public function jump() : voidCalled when the entity jumps from the ground. This method adds upwards velocity to the entity.
knockBack()
public function knockBack(float $x, float $z, float $force = self::DEFAULT_KNOCKBACK_FORCE, ?float $verticalLimit = self::DEFAULT_KNOCKBACK_VERTICAL_LIMIT) : voidlookAt()
public function lookAt(\pocketmine\math\Vector3 $target) : voidChanges 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
protected function move(float $dx, float $dy, float $dz) : voidonAirExpired()
public function onAirExpired() : voidCalled 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
protected function onDeath() : voidonDeathUpdate() protected
protected function onDeathUpdate(int $tickDiff) : boolonDispose() protected
protected function onDispose() : voidonHitGround() protected
protected function onHitGround() : ?floatsaveNBT()
public function saveNBT() : \pocketmine\nbt\tag\CompoundTagsendSpawnPacket() protected
protected function sendSpawnPacket(\pocketmine\player\Player $player) : voidsetAbsorption()
public function setAbsorption(float $absorption) : voidsetAirSupplyTicks()
public function setAirSupplyTicks(int $ticks) : voidSets the number of air ticks left in the entity's air supply.
setBreathing()
public function setBreathing(bool $value = true) : voidSets 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
public function setFallDamageCutoffY(?float $y) : voidMakes 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()
public function setGliding(bool $value = true) : voidsetHealth()
public function setHealth(float $amount) : voidsetInPowderSnow() 5.46.0
public function setInPowderSnow() : voidCalled by powder snow for entities inside it, every tick (see Living::doFreezeTick()).
setMaxAirSupplyTicks()
public function setMaxAirSupplyTicks(int $ticks) : voidSets the maximum amount of air ticks the air supply can hold.
setMaxHealth()
public function setMaxHealth(int $amount) : voidsetMovementSpeed()
public function setMovementSpeed(float $v, bool $fit = false) : voidsetOnFire()
public function setOnFire(int $seconds) : voidsetSneaking()
public function setSneaking(bool $value = true) : voidsetSpawnReason() 5.46.0
public function setSpawnReason(string $reason) : voidsetSprinting()
public function setSprinting(bool $value = true) : voidsetSwimming()
public function setSwimming(bool $value = true) : voidsetTicksFrozen() 5.46.0
public function setTicksFrozen(int $ticks) : voidstartDeathAnimation() protected
protected function startDeathAnimation() : voidsyncNetworkData() protected
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : void