Squid
extends WaterAnimal
in package
Table of Contents
- MOTION_THRESHOLD = 1.0E-5
- DEFAULT_BREATH_TICKS = 300
- STEP_CLIP_MULTIPLIER = 0.4
- $boundingBox : AxisAlignedBB
- $canCollide : bool
- $deadTicks : int
- $fallDistance : float
- $isCollided : bool
- $isCollidedHorizontally : bool
- $isCollidedVertically : bool
- $keepMovement : bool
- $lastUpdate : int
- $noDamageTicks : int
- $onGround : bool
- $size : EntitySizeInfo
- $swimDirection : Vector3|null
- $swimSpeed : float
- $ticksLived : int
- $absorptionAttr : Attribute
- $alwaysShowNameTag : bool
- $armorInventory : ArmorInventory
- $attackTime : int
- $attributeMap : AttributeMap
- $baby : bool
- $blocksAround : array<string|int, Block>|null
- $breathing : bool
- $breathTicks : int
- $canClimb : bool
- $canClimbWalls : bool
- $closed : bool
- $drag : float
- $effectManager : EffectManager
- $fireTicks : int
- $forceMovementUpdate : bool
- $gravity : float
- $gravityEnabled : bool
- $hasSpawned : array<string|int, Player>
- $healthAttr : Attribute
- $id : int
- $immobile : bool
- $invisible : bool
- $isStatic : bool
- $jumpVelocity : float
- $justCreated : bool
- $knockbackResistanceAttr : Attribute
- $lastDamageCause : EntityDamageEvent|null
- $lastLocation : Location
- $lastMotion : Vector3
- $location : Location
- $maxBreathTicks : int
- $maxDeadTicks : int
- $motion : Vector3
- $moveSpeedAttr : Attribute
- $nameTag : string
- $nameTagVisible : bool
- $networkPropertiesDirty : bool
- $ownerId : int|null
- $scale : float
- $scoreTag : string
- $server : Server
- $silent : bool
- $sneaking : bool
- $sprinting : bool
- $stepHeight : float
- $targetId : int|null
- $timings : TimingsHandler
- $ySize : float
- $closeInFlight : bool
- $entityCount : int
- $health : float
- $maxHealth : int
- $needsDespawn : bool
- $networkProperties : EntityMetadataCollection
- $savedWithChunk : bool
- $switchDirectionTicker : int
- __construct() : mixed
- __destruct() : mixed
- __toString() : mixed
- addMotion() : void
- Adds the given values to the entity's motion vector.
- applyDamageModifiers() : void
- Called prior to EntityDamageEvent execution to apply modifications to the event's damage, such as reduction due to effects or armour.
- 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.
- canBreathe() : bool
- Returns whether the entity can currently breathe.
- 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.
- consumeObject() : bool
- Causes the mob to consume the given Consumable object, applying applicable effects, health bonuses, food bonuses, etc.
- damageArmor() : 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.
- despawnFrom() : void
- despawnFromAll() : void
- extinguish() : void
- flagForDespawn() : void
- Flags the entity to be removed from the world on the next tick.
- getAbsorption() : float
- 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() : ArmorInventory
- getArmorPoints() : int
- Returns how many armour points this mob has. Armour points provide a percentage reduction to damage.
- getAttributeMap() : AttributeMap
- getBoundingBox() : AxisAlignedBB
- getDirectionPlane() : Vector2
- getDirectionVector() : Vector3
- getDrops() : array<string|int, mixed>
- getEffects() : EffectManager
- getEyeHeight() : float
- getEyePos() : Vector3
- getFallDistance() : float
- getFireTicks() : int
- getHealth() : float
- getHighestArmorEnchantmentLevel() : int
- Returns the highest level of the specified enchantment on any armour piece that the entity is currently wearing.
- getHorizontalFacing() : int
- getId() : int
- getJumpVelocity() : float
- Returns the initial upwards velocity of a jumping entity in blocks/tick, including additional velocity due to effects.
- getLastDamageCause() : EntityDamageEvent|null
- getLineOfSight() : array<string|int, Block>
- getLocation() : Location
- getMaxAirSupplyTicks() : int
- Returns the maximum amount of air ticks the entity's air supply can contain.
- getMaxHealth() : int
- getMotion() : Vector3
- getMovementSpeed() : float
- getName() : string
- 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.
- getPosition() : Position
- getScale() : float
- getScoreTag() : string|null
- getTargetBlock() : Block|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
- getXpDropAmount() : int
- Returns the amount of XP this mob will drop on death.
- hasGravity() : bool
- hasLineOfSight() : bool
- hasMovementUpdate() : bool
- Returns whether the entity needs a movement update on the next tick.
- heal() : void
- initEntity() : void
- isAlive() : bool
- isBaby() : bool
- isBreathing() : bool
- Returns whether the entity is currently breathing or not. If this is false, the entity's air supply will be used.
- isClosed() : bool
- Returns whether the entity has been "closed".
- isFireProof() : bool
- isFlaggedForDespawn() : bool
- isImmobile() : bool
- isInsideOfSolid() : bool
- isInvisible() : bool
- isNameTagAlwaysVisible() : bool
- isNameTagVisible() : bool
- isOnFire() : bool
- isOnGround() : bool
- isSilent() : bool
- isSneaking() : bool
- isSprinting() : bool
- isUnderwater() : bool
- jump() : void
- Called when the entity jumps from the ground. This method adds upwards velocity to the entity.
- kill() : void
- knockBack() : void
- lookAt() : 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.
- nextRuntimeId() : int
- Returns a new runtime entity ID for a new entity.
- 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.
- 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
- setAbsorption() : void
- setAirSupplyTicks() : void
- Sets the number of air ticks left in the entity's air supply.
- setBreathing() : void
- Sets whether the entity is currently breathing. If false, it will cause the entity's air supply to be used.
- 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.
- 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
- setMaxAirSupplyTicks() : void
- Sets the maximum amount of air ticks the air supply can hold.
- setMaxHealth() : void
- setMotion() : bool
- setMovementSpeed() : void
- setNameTag() : void
- setNameTagAlwaysVisible() : void
- setNameTagVisible() : void
- setOnFire() : void
- setOwningEntity() : void
- Sets the owner of the entity. Passing null will remove the current owner.
- setRotation() : void
- setScale() : void
- setScoreTag() : void
- setSilent() : void
- setSneaking() : void
- setSprinting() : void
- setTargetEntity() : void
- Sets the entity's target entity. Passing null will remove the current target.
- spawnTo() : void
- spawnToAll() : void
- teleport() : bool
- addAttributes() : void
- applyConsumptionResults() : void
- Applies effects from consuming the object. This shouldn't do any can-consume checks (those are expected to be handled by the caller).
- applyDragBeforeGravity() : bool
- applyPostDamageEffects() : void
- Called after EntityDamageEvent execution to apply post-hurt effects, such as reducing absorption or modifying armour durability.
- broadcastMotion() : void
- broadcastMovement() : void
- calculateFallDamage() : float
- 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.
- doAirSupplyTick() : bool
- Ticks the entity's air supply, consuming it when underwater and regenerating it when out of water.
- doHitAnimation() : void
- doOnFireTick() : bool
- endDeathAnimation() : void
- entityBaseTick() : bool
- getAllNetworkData() : array<string|int, MetadataProperty>
- getBlocksAroundWithEntityInsideActions() : array<string|int, Block>
- getDirtyNetworkData() : array<string|int, MetadataProperty>
- getInitialSizeInfo() : EntitySizeInfo
- 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.
- 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
- startDeathAnimation() : void
- syncNetworkData() : void
- tryChangeMovement() : void
- updateFallState() : float|null
- updateMovement() : void
- damageItem() : void
- generateRandomDirection() : Vector3
Constants
MOTION_THRESHOLD
public
mixed
MOTION_THRESHOLD
= 1.0E-5
DEFAULT_BREATH_TICKS
protected
mixed
DEFAULT_BREATH_TICKS
= 300
STEP_CLIP_MULTIPLIER
protected
mixed
STEP_CLIP_MULTIPLIER
= 0.4
Properties
$boundingBox
public
AxisAlignedBB
$boundingBox
$canCollide
public
bool
$canCollide
= true
$deadTicks
public
int
$deadTicks
= 0
$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
$size
public
EntitySizeInfo
$size
$swimDirection
public
Vector3|null
$swimDirection
= null
$swimSpeed
public
float
$swimSpeed
= 0.1
$ticksLived
public
int
$ticksLived
= 0
$absorptionAttr
protected
Attribute
$absorptionAttr
$alwaysShowNameTag
protected
bool
$alwaysShowNameTag
= false
$armorInventory
protected
ArmorInventory
$armorInventory
$attackTime
protected
int
$attackTime
= 0
$attributeMap
protected
AttributeMap
$attributeMap
$baby
protected
bool
$baby
= false
$blocksAround
protected
array<string|int, Block>|null
$blocksAround
$breathing
protected
bool
$breathing
= true
$breathTicks
protected
int
$breathTicks
= self::DEFAULT_BREATH_TICKS
$canClimb
protected
bool
$canClimb
= false
$canClimbWalls
protected
bool
$canClimbWalls
= false
$closed
protected
bool
$closed
= false
$drag
protected
float
$drag
$effectManager
protected
EffectManager
$effectManager
$fireTicks
protected
int
$fireTicks
= 0
$forceMovementUpdate
protected
bool
$forceMovementUpdate
= false
$gravity
protected
float
$gravity
$gravityEnabled
protected
bool
$gravityEnabled
= true
$hasSpawned
protected
array<string|int, Player>
$hasSpawned
= []
$healthAttr
protected
Attribute
$healthAttr
$id
protected
int
$id
$immobile
protected
bool
$immobile
= false
$invisible
protected
bool
$invisible
= false
$isStatic
protected
bool
$isStatic
= false
$jumpVelocity
protected
float
$jumpVelocity
= 0.42
$justCreated
protected
bool
$justCreated
= true
$knockbackResistanceAttr
protected
Attribute
$knockbackResistanceAttr
$lastDamageCause
protected
EntityDamageEvent|null
$lastDamageCause
= null
$lastLocation
protected
Location
$lastLocation
$lastMotion
protected
Vector3
$lastMotion
$location
protected
Location
$location
$maxBreathTicks
protected
int
$maxBreathTicks
= self::DEFAULT_BREATH_TICKS
$maxDeadTicks
protected
int
$maxDeadTicks
= 25
$motion
protected
Vector3
$motion
$moveSpeedAttr
protected
Attribute
$moveSpeedAttr
$nameTag
protected
string
$nameTag
= ""
$nameTagVisible
protected
bool
$nameTagVisible
= true
$networkPropertiesDirty
protected
bool
$networkPropertiesDirty
= false
$ownerId
protected
int|null
$ownerId
= null
$scale
protected
float
$scale
= 1.0
$scoreTag
protected
string
$scoreTag
= ""
$server
protected
Server
$server
$silent
protected
bool
$silent
= false
$sneaking
protected
bool
$sneaking
= false
$sprinting
protected
bool
$sprinting
= false
$stepHeight
protected
float
$stepHeight
= 0.0
$targetId
protected
int|null
$targetId
= null
$timings
protected
TimingsHandler
$timings
$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
$networkProperties
private
EntityMetadataCollection
$networkProperties
$savedWithChunk
private
bool
$savedWithChunk
= true
$switchDirectionTicker
private
int
$switchDirectionTicker
= 0
Methods
__construct()
public
__construct(Location $location[, CompoundTag|null $nbt = null ]) : mixed
Parameters
- $location : Location
- $nbt : CompoundTag|null = null
Return values
mixed —__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 —applyDamageModifiers()
Called prior to EntityDamageEvent execution to apply modifications to the event's damage, such as reduction due to effects or armour.
public
applyDamageModifiers(EntityDamageEvent $source) : void
Parameters
- $source : EntityDamageEvent
Return values
void —attack()
public
attack(EntityDamageEvent $source) : void
Parameters
- $source : EntityDamageEvent
Return values
void —broadcastAnimation()
public
broadcastAnimation(Animation $animation[, array<string|int, Player>|null $targets = null ]) : void
Parameters
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
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 —canBreathe()
Returns whether the entity can currently breathe.
public
canBreathe() : 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 —consumeObject()
Causes the mob to consume the given Consumable object, applying applicable effects, health bonuses, food bonuses, etc.
public
consumeObject(Consumable $consumable) : bool
Parameters
- $consumable : Consumable
Return values
bool —damageArmor()
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.
public
damageArmor(float $damage) : void
Parameters
- $damage : float
Return values
void —despawnFrom()
public
despawnFrom(Player $player[, bool $send = true ]) : void
Parameters
- $player : Player
- $send : bool = true
Tags
Return values
void —despawnFromAll()
public
despawnFromAll() : void
Tags
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 —getAbsorption()
public
getAbsorption() : float
Return values
float —getAirSupplyTicks()
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.
public
getAirSupplyTicks() : int
Return values
int —getArmorInventory()
public
getArmorInventory() : ArmorInventory
Return values
ArmorInventory —getArmorPoints()
Returns how many armour points this mob has. Armour points provide a percentage reduction to damage.
public
getArmorPoints() : int
For mobs which can wear armour, this should return the sum total of the armour points provided by their equipment.
Return values
int —getAttributeMap()
public
getAttributeMap() : AttributeMap
Return values
AttributeMap —getBoundingBox()
public
getBoundingBox() : AxisAlignedBB
Return values
AxisAlignedBB —getDirectionPlane()
public
getDirectionPlane() : Vector2
Return values
Vector2 —getDirectionVector()
public
getDirectionVector() : Vector3
Return values
Vector3 —getDrops()
public
getDrops() : array<string|int, mixed>
Return values
array<string|int, mixed> —getEffects()
public
getEffects() : EffectManager
Return values
EffectManager —getEyeHeight()
public
getEyeHeight() : float
Return values
float —getEyePos()
public
getEyePos() : Vector3
Return values
Vector3 —getFallDistance()
public
getFallDistance() : float
Return values
float —getFireTicks()
public
getFireTicks() : int
Return values
int —getHealth()
public
getHealth() : float
Return values
float —getHighestArmorEnchantmentLevel()
Returns the highest level of the specified enchantment on any armour piece that the entity is currently wearing.
public
getHighestArmorEnchantmentLevel(Enchantment $enchantment) : int
Parameters
- $enchantment : Enchantment
Return values
int —getHorizontalFacing()
public
getHorizontalFacing() : int
Return values
int —getId()
public
getId() : int
Return values
int —getJumpVelocity()
Returns the initial upwards velocity of a jumping entity in blocks/tick, including additional velocity due to effects.
public
getJumpVelocity() : float
Return values
float —getLastDamageCause()
public
getLastDamageCause() : EntityDamageEvent|null
Return values
EntityDamageEvent|null —getLineOfSight()
public
getLineOfSight(int $maxDistance[, int $maxLength = 0 ][, array<string|int, true> $transparent = [] ]) : array<string|int, Block>
Parameters
- $maxDistance : int
- $maxLength : int = 0
- $transparent : array<string|int, true> = []
Tags
Return values
array<string|int, Block> —getLocation()
public
getLocation() : Location
Return values
Location —getMaxAirSupplyTicks()
Returns the maximum amount of air ticks the entity's air supply can contain.
public
getMaxAirSupplyTicks() : int
Return values
int —getMaxHealth()
public
getMaxHealth() : int
Return values
int —getMotion()
public
getMotion() : Vector3
Return values
Vector3 —getMovementSpeed()
public
getMovementSpeed() : float
Return values
float —getName()
public
getName() : string
Return values
string —getNameTag()
public
getNameTag() : string
Return values
string —getNetworkProperties()
public
getNetworkProperties() : EntityMetadataCollection
Return values
EntityMetadataCollection —getNetworkTypeId()
public
static getNetworkTypeId() : string
Return values
string —getOffsetPosition()
public
getOffsetPosition(Vector3 $vector3) : Vector3
Parameters
- $vector3 : Vector3
Return values
Vector3 —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 —getPosition()
public
getPosition() : Position
Return values
Position —getScale()
public
getScale() : float
Return values
float —getScoreTag()
public
getScoreTag() : string|null
Return values
string|null —getTargetBlock()
public
getTargetBlock(int $maxDistance[, array<string|int, true> $transparent = [] ]) : Block|null
Parameters
- $maxDistance : int
- $transparent : array<string|int, true> = []
Tags
Return values
Block|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> —getWorld()
public
getWorld() : World
Return values
World —getXpDropAmount()
Returns the amount of XP this mob will drop on death.
public
getXpDropAmount() : int
Return values
int —hasGravity()
public
hasGravity() : bool
Return values
bool —hasLineOfSight()
public
hasLineOfSight(Entity $entity) : bool
Parameters
- $entity : Entity
Return values
bool —hasMovementUpdate()
Returns whether the entity needs a movement update on the next tick.
public
hasMovementUpdate() : bool
Return values
bool —heal()
public
heal(EntityRegainHealthEvent $source) : void
Parameters
- $source : EntityRegainHealthEvent
Return values
void —initEntity()
public
initEntity(CompoundTag $nbt) : void
Parameters
- $nbt : CompoundTag
Return values
void —isAlive()
public
isAlive() : bool
Return values
bool —isBaby()
public
isBaby() : bool
Return values
bool —isBreathing()
Returns whether the entity is currently breathing or not. If this is false, the entity's air supply will be used.
public
isBreathing() : bool
Return values
bool —isClosed()
Returns whether the entity has been "closed".
public
isClosed() : 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 —isSneaking()
public
isSneaking() : bool
Return values
bool —isSprinting()
public
isSprinting() : bool
Return values
bool —isUnderwater()
public
isUnderwater() : bool
Return values
bool —jump()
Called when the entity jumps from the ground. This method adds upwards velocity to the entity.
public
jump() : void
Return values
void —kill()
public
kill() : void
Return values
void —knockBack()
public
knockBack(float $x, float $z[, float $force = 0.4 ][, float|null $verticalLimit = 0.4 ]) : void
Parameters
- $x : float
- $z : float
- $force : float = 0.4
- $verticalLimit : float|null = 0.4
Return values
void —lookAt()
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.
public
lookAt(Vector3 $target) : void
Parameters
- $target : Vector3
Return values
void —nextRuntimeId()
Returns a new runtime entity ID for a new entity.
public
static nextRuntimeId() : int
Return values
int —onAirExpired()
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.
public
onAirExpired() : void
Return values
void —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
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 —saveNBT()
public
saveNBT() : CompoundTag
Return values
CompoundTag —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
Return values
void —setAbsorption()
public
setAbsorption(float $absorption) : void
Parameters
- $absorption : float
Return values
void —setAirSupplyTicks()
Sets the number of air ticks left in the entity's air supply.
public
setAirSupplyTicks(int $ticks) : void
Parameters
- $ticks : int
Return values
void —setBreathing()
Sets whether the entity is currently breathing. If false, it will cause the entity's air supply to be used.
public
setBreathing([bool $value = true ]) : void
For players, this also shows the oxygen bar.
Parameters
- $value : bool = true
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 —setFallDistance()
public
setFallDistance(float $fallDistance) : void
Parameters
- $fallDistance : float
Return values
void —setFireTicks()
public
setFireTicks(int $fireTicks) : void
Parameters
- $fireTicks : int
Tags
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 —setLastDamageCause()
public
setLastDamageCause(EntityDamageEvent $type) : void
Parameters
- $type : EntityDamageEvent
Return values
void —setMaxAirSupplyTicks()
Sets the maximum amount of air ticks the air supply can hold.
public
setMaxAirSupplyTicks(int $ticks) : void
Parameters
- $ticks : int
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 —setMovementSpeed()
public
setMovementSpeed(float $v[, bool $fit = false ]) : void
Parameters
- $v : float
- $fit : bool = false
Return values
void —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
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 —setSneaking()
public
setSneaking([bool $value = true ]) : void
Parameters
- $value : bool = true
Return values
void —setSprinting()
public
setSprinting([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
Return values
void —spawnTo()
public
spawnTo(Player $player) : void
Parameters
- $player : Player
Return values
void —spawnToAll()
public
spawnToAll() : void
Return values
void —teleport()
public
teleport(Vector3|Position|Location $pos[, float|null $yaw = null ][, float|null $pitch = null ]) : bool
Parameters
Return values
bool —addAttributes()
protected
addAttributes() : void
Return values
void —applyConsumptionResults()
Applies effects from consuming the object. This shouldn't do any can-consume checks (those are expected to be handled by the caller).
protected
applyConsumptionResults(Consumable $consumable) : void
Parameters
- $consumable : Consumable
Return values
void —applyDragBeforeGravity()
protected
applyDragBeforeGravity() : bool
Return values
bool —applyPostDamageEffects()
Called after EntityDamageEvent execution to apply post-hurt effects, such as reducing absorption or modifying armour durability.
protected
applyPostDamageEffects(EntityDamageEvent $source) : void
This will not be called by damage sources causing death.
Parameters
- $source : EntityDamageEvent
Return values
void —broadcastMotion()
protected
broadcastMotion() : void
Return values
void —broadcastMovement()
protected
broadcastMovement([bool $teleport = false ]) : void
Parameters
- $teleport : bool = false
Return values
void —calculateFallDamage()
protected
calculateFallDamage(float $fallDistance) : float
Parameters
- $fallDistance : float
Return values
float —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 —doAirSupplyTick()
Ticks the entity's air supply, consuming it when underwater and regenerating it when out of water.
protected
doAirSupplyTick(int $tickDiff) : bool
Parameters
- $tickDiff : int
Return values
bool —doHitAnimation()
protected
doHitAnimation() : void
Return values
void —doOnFireTick()
protected
doOnFireTick([int $tickDiff = 1 ]) : bool
Parameters
- $tickDiff : int = 1
Return values
bool —endDeathAnimation()
protected
endDeathAnimation() : void
Return values
void —entityBaseTick()
protected
entityBaseTick([int $tickDiff = 1 ]) : bool
Parameters
- $tickDiff : int = 1
Return values
bool —getAllNetworkData()
protected
final getAllNetworkData() : array<string|int, MetadataProperty>
Tags
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
Return values
array<string|int, MetadataProperty> —getInitialSizeInfo()
protected
getInitialSizeInfo() : EntitySizeInfo
Return values
EntitySizeInfo —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 —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 —startDeathAnimation()
protected
startDeathAnimation() : void
Return values
void —syncNetworkData()
protected
syncNetworkData(EntityMetadataCollection $properties) : void
Parameters
- $properties : EntityMetadataCollection
Return values
void —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 —damageItem()
private
damageItem(Durable $item, int $durabilityRemoved) : void
Parameters
- $item : Durable
- $durabilityRemoved : int
Return values
void —generateRandomDirection()
private
generateRandomDirection() : Vector3