Package org.bukkit.entity

# Interface LivingEntity

All Superinterfaces:
  `Attributable`, `Audience`, `CommandSender`, `Damageable`, `Entity`, `HoverEventSource<HoverEvent.ShowEntity>`, `Metadatable`, `Nameable`, `Permissible`, `PersistentDataHolder`, `Pointered`, `ProjectileSource`, `ServerOperator`, `Sound.Emitter`

All Known Subinterfaces:
  `AbstractHorse`, `AbstractSkeleton`, `AbstractVillager`, `Ageable`, `Ambient`, `Animals`, `ArmorStand`, `Axolotl`, `Bat`, `Bee`, `Blaze`, `Breedable`, `Cat`, `CaveSpider`, `ChestedHorse`, `Chicken`, `Cod`, `ComplexLivingEntity`, `Cow`, `Creature`, `Creeper`, `Dolphin`, `Donkey`, `Drowned`, `ElderGuardian`, `EnderDragon`, `Enderman`, `Endermite`, `Evoker`, `Fish`, `Flying`, `Fox`, `Ghast`, `Giant`, `GlowSquid`, `Goat`, `Golem`, `Guardian`, `Hoglin`, `Horse`, `HumanEntity`, `Husk`, `Illager`, `Illusioner`, `IronGolem`, `Llama`, `MagmaCube`, `Mob`, `Monster`, `Mule`, `MushroomCow`, `NPC`, `Ocelot`, `Panda`, `Parrot`, `Phantom`, `Pig`, `Piglin`, `PiglinAbstract`, `PiglinBrute`, `PigZombie`, `Pillager`, `Player`, `PolarBear`, `PufferFish`, `Rabbit`, `Raider`, `RangedEntity`, `Ravager`, `Salmon`, `Sheep`, `Shulker`, `Silverfish`, `Skeleton`, `SkeletonHorse`, `Slime`, `Snowman`, `Spellcaster`, `Spider`, `Squid`, `Steerable`, `Stray`, `Strider`, `Tameable`, `TraderLlama`, `TropicalFish`, `Turtle`, `Vex`, `Villager`, `Vindicator`, `WanderingTrader`, `WaterMob`, `Witch`, `Wither`, `WitherSkeleton`, `Wolf`, `Zoglin`, `Zombie`, `ZombieHorse`, `ZombieVillager`

public interface LivingEntity extends Attributable, Damageable, ProjectileSource
Represents a living entity, such as a monster or player

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.bukkit.entity.Entity

`Entity.Spigot`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`addPotionEffect(@NotNull PotionEffect effect)`
Adds the given `PotionEffect` to the living entity.
`boolean`
`addPotionEffect(@NotNull PotionEffect effect, boolean force)`
Deprecated.
no need to force since multiple effects of the same type are now supported.
`boolean`
`addPotionEffects(@NotNull Collection<PotionEffect> effects)`
Attempts to add all of the given `PotionEffect` to the living entity.
`void`
`attack(@NotNull Entity target)`
Makes this entity attack the given entity with a melee attack.
`void`
`clearActiveItem()`
Interrupts any ongoing active "usage" or consumption or an item.
`@Nullable ItemStack`
`getActiveItem()`
Get's the item being actively "used" or consumed.
`@NotNull Collection<PotionEffect>`
`getActivePotionEffects()`
Returns all currently active `PotionEffect`s on the living entity.
`int`
`getArrowCooldown()`
Gets the time in ticks until the next arrow leaves the entity's body.
`int`
`getArrowsInBody()`
Gets the amount of arrows in an entity's body.
`int`
`getArrowsStuck()`
Get the number of arrows stuck in this entity
`int`
`getBeeStingerCooldown()`
Gets the time in ticks until the next bee stinger leaves the entity's body.
`int`
`getBeeStingersInBody()`
Gets the amount of bee stingers in an entity's body.
`boolean`
`getCanPickupItems()`
Gets if the living entity can pick up items.
`@NotNull EntityCategory`
`getCategory()`
Get the category to which this entity belongs.
`@NotNull Set<UUID>`
`getCollidableExemptions()`
Gets a mutable set of UUIDs of the entities which are exempt from the entity's collidable rule and which's collision with this entity will behave the opposite of it.
`@Nullable EntityEquipment`
`getEquipment()`
Gets the inventory with the equipment worn by the living entity.
`double`
`getEyeHeight()`
Gets the height of the living entity's eyes above its Location.
`double`
`getEyeHeight(boolean ignorePose)`
Gets the height of the living entity's eyes above its Location.
`@NotNull Location`
`getEyeLocation()`
Get a Location detailing the current eye position of the living entity.
`EquipmentSlot`
`getHandRaised()`
Gets the hand raised by this living entity.
`int`
`getHandRaisedTime()`
Get how long the players hands have been raised (Charging Bow attack, using a potion, etc)
`float`
`getHurtDirection()`
Gets player hurt direction
`int`
`getItemUseRemainingTime()`
Get's remaining time a player needs to keep hands raised with an item to finish using it.
`@Nullable Player`
`getKiller()`
Gets the player identified as the killer of the living entity.
`double`
`getLastDamage()`
Returns the living entity's last damage taken in the current no damage ticks time.
`@NotNull List<Block>`
`getLastTwoTargetBlocks(@Nullable Set<Material> transparent, int maxDistance)`
Gets the last two blocks along the living entity's line of sight.
`@NotNull Entity`
`getLeashHolder()`
Gets the entity that is currently leading this entity.
`@NotNull List<Block>`
`getLineOfSight(@Nullable Set<Material> transparent, int maxDistance)`
Gets all blocks along the living entity's line of sight.
`int`
`getMaximumAir()`
Returns the maximum amount of air the living entity can have, in ticks.
`int`
`getMaximumNoDamageTicks()`
Returns the living entity's current maximum no damage ticks.
`<T> T`
`getMemory(@NotNull MemoryKey<T> memoryKey)`
Returns the value of the memory specified.
`int`
`getNoDamageTicks()`
Returns the living entity's current no damage ticks.
`@Nullable PotionEffect`
`getPotionEffect(@NotNull PotionEffectType type)`
Returns the active `PotionEffect` of the specified type.
`int`
`getRemainingAir()`
Returns the amount of air that the living entity has remaining, in ticks.
`boolean`
`getRemoveWhenFarAway()`
Returns if the living entity despawns when away from players or not.
`int`
`getShieldBlockingDelay()`
Get the delay (in ticks) before blocking is effective for this entity
`default @Nullable Block`
`getTargetBlock(int maxDistance)`
Gets the block that the living entity has targeted, ignoring fluids
`@Nullable Block`
`getTargetBlock(int maxDistance, TargetBlockInfo.FluidMode fluidMode)`
Gets the block that the living entity has targeted
`@NotNull Block`
`getTargetBlock(@Nullable Set<Material> transparent, int maxDistance)`
Gets the block that the living entity has targeted.
`@Nullable Block`
`getTargetBlockExact(int maxDistance)`
Gets the block that the living entity has targeted.
`@Nullable Block`
`getTargetBlockExact(int maxDistance, @NotNull FluidCollisionMode fluidCollisionMode)`
Gets the block that the living entity has targeted.
`default BlockFace`
`getTargetBlockFace(int maxDistance)`
Gets the blockface of that block that the living entity has targeted, ignoring fluids
`BlockFace`
`getTargetBlockFace(int maxDistance, TargetBlockInfo.FluidMode fluidMode)`
Gets the blockface of that block that the living entity has targeted
`default TargetBlockInfo`
`getTargetBlockInfo(int maxDistance)`
Gets information about the block the living entity has targeted, ignoring fluids
`TargetBlockInfo`
`getTargetBlockInfo(int maxDistance, TargetBlockInfo.FluidMode fluidMode)`
Gets information about the block the living entity has targeted
`default @Nullable Entity`
`getTargetEntity(int maxDistance)`
Gets information about the entity being targeted
`@Nullable Entity`
`getTargetEntity(int maxDistance, boolean ignoreBlocks)`
Gets information about the entity being targeted
`default TargetEntityInfo`
`getTargetEntityInfo(int maxDistance)`
Gets information about the entity being targeted
`TargetEntityInfo`
`getTargetEntityInfo(int maxDistance, boolean ignoreBlocks)`
Gets information about the entity being targeted
`boolean`
`hasAI()`
Checks whether an entity has AI.
`boolean`
`hasLineOfSight(@NotNull Entity other)`
Checks whether the living entity has block line of sight to another.
`boolean`
`hasLineOfSight(@NotNull Location location)`
Checks whether the living entity has block line of sight to the given block.
`boolean`
`hasPotionEffect(@NotNull PotionEffectType type)`
Returns whether the living entity already has an existing effect of the given `PotionEffectType` applied to it.
`boolean`
`isClimbing()`
Gets if the entity is climbing.
`boolean`
`isCollidable()`
Gets if this entity is subject to collisions with other entities.
`boolean`
`isGliding()`
Checks to see if an entity is gliding, such as using an Elytra.
`boolean`
`isHandRaised()`
Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food)
`boolean`
`isInvisible()`
Gets whether the entity is invisible or not.
`boolean`
`isJumping()`
Get entity jump state.
`boolean`
`isLeashed()`
Returns whether the entity is currently leashed.
`boolean`
`isRiptiding()`
Checks to see if an entity is currently using the Riptide enchantment.
`boolean`
`isSleeping()`
Returns whether this entity is slumbering.
`boolean`
`isSwimming()`
Checks to see if an entity is swimming.
`default void`
`playPickupItemAnimation(@NotNull Item item)`
Plays pickup item animation towards this entity.
`void`
`playPickupItemAnimation(@NotNull Item item, int quantity)`
Plays pickup item animation towards this entity.
`@Nullable RayTraceResult`
`rayTraceBlocks(double maxDistance)`
Performs a ray trace that provides information on the targeted block.
`@Nullable RayTraceResult`
`rayTraceBlocks(double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode)`
Performs a ray trace that provides information on the targeted block.
`void`
`removePotionEffect(@NotNull PotionEffectType type)`
Removes any effects present of the given `PotionEffectType`.
`void`
`setAI(boolean ai)`
Sets whether an entity will have AI.
`void`
`setArrowCooldown(int ticks)`
Sets the time in ticks until the next arrow leaves the entity's body.
`void`
`setArrowsInBody(int count)`
Set the amount of arrows in the entity's body.
`void`
`setArrowsStuck(int arrows)`
Set the number of arrows stuck in this entity
`void`
`setBeeStingerCooldown(int ticks)`
Sets the time in ticks until the next stinger leaves the entity's body.
`void`
`setBeeStingersInBody(int count)`
Set the amount of bee stingers in the entity's body.
`void`
`setCanPickupItems(boolean pickup)`
Sets whether or not the living entity can pick up items.
`void`
`setCollidable(boolean collidable)`
Set if this entity will be subject to collisions with other entities.
`void`
`setGliding(boolean gliding)`
Makes entity start or stop gliding.
`void`
`setHurtDirection(float hurtDirection)`
Sets player hurt direction
`void`
`setInvisible(boolean invisible)`
Sets whether the entity is invisible or not.
`void`
`setJumping(boolean jumping)`
Set entity jump state
`void`
`setKiller(@Nullable Player killer)`
Sets the player identified as the killer of the living entity.
`void`
`setLastDamage(double damage)`
Sets the damage dealt within the current no damage ticks time period.
`boolean`
`setLeashHolder(@Nullable Entity holder)`
Sets the leash on this entity to be held by the supplied entity.
`void`
`setMaximumAir(int ticks)`
Sets the maximum amount of air the living entity can have, in ticks.
`void`
`setMaximumNoDamageTicks(int ticks)`
Sets the living entity's current maximum no damage ticks.
`<T> void`
`setMemory(@NotNull MemoryKey<T> memoryKey, T memoryValue)`
Sets the value of the memory specified.
`void`
`setNoDamageTicks(int ticks)`
Sets the living entity's current no damage ticks.
`void`
`setRemainingAir(int ticks)`
Sets the amount of air that the living entity has remaining, in ticks.
`void`
`setRemoveWhenFarAway(boolean remove)`
Sets whether or not the living entity despawns when away from players or not.
`void`
`setShieldBlockingDelay(int delay)`
Set the delay (in ticks) before blocking is effective for this entity
`void`
`setSwimming(boolean swimming)`
Makes entity start or stop swimming.
`void`
`swingMainHand()`
Makes this entity swing their main hand.
`void`
`swingOffHand()`
Makes this entity swing their off hand.

### Methods inherited from interface org.bukkit.attribute.Attributable

`getAttribute, registerAttribute`

### Methods inherited from interface net.kyori.adventure.audience.Audience

`clearTitle, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendTitlePart, showBossBar, showTitle, stopSound, stopSound`

### Methods inherited from interface org.bukkit.command.CommandSender

`getName, name, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage`

### Methods inherited from interface org.bukkit.entity.Damageable

`damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth`

### Methods inherited from interface org.bukkit.entity.Entity

`addPassenger, addScoreboardTag, asHoverEvent, eject, fromMobSpawner, getBoundingBox, getChunk, getEntityId, getEntitySpawnReason, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getOrigin, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getTicksLived, getTrackedPlayers, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isFrozen, isGlowing, isInBubbleColumn, isInLava, isInRain, isInsideVehicle, isInvulnerable, isInWater, isInWaterOrBubbleColumn, isInWaterOrRain, isInWaterOrRainOrBubbleColumn, isOnGround, isPersistent, isSilent, isTicking, isValid, isVisualFire, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, setVisualFire, spawnAt, spawnAt, spigot, teamDisplayName, teleport, teleport, teleport, teleport, teleportAsync, teleportAsync`

### Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource

`asHoverEvent`

### Methods inherited from interface org.bukkit.metadata.Metadatable

`getMetadata, hasMetadata, removeMetadata, setMetadata`

### Methods inherited from interface org.bukkit.Nameable

`customName, customName, getCustomName, setCustomName`

### Methods inherited from interface org.bukkit.permissions.Permissible

`addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, permissionValue, permissionValue, recalculatePermissions, removeAttachment`

### Methods inherited from interface org.bukkit.persistence.PersistentDataHolder

`getPersistentDataContainer`

### Methods inherited from interface net.kyori.adventure.pointer.Pointered

`get, getOrDefault, getOrDefaultFrom, pointers`

### Methods inherited from interface org.bukkit.projectiles.ProjectileSource

`launchProjectile, launchProjectile`

### Methods inherited from interface org.bukkit.permissions.ServerOperator

`isOp, setOp`

## Method Details

### getEyeHeight

double getEyeHeight()
Gets the height of the living entity's eyes above its Location.

Returns:
  height of the living entity's eyes above its location

### getEyeHeight

double getEyeHeight(boolean ignorePose)
Gets the height of the living entity's eyes above its Location.

Parameters:
  `ignorePose` - if set to true, the effects of pose changes, eg sneaking and gliding will be ignored
Returns:
  height of the living entity's eyes above its location

### getEyeLocation

@NotNull @NotNull Location getEyeLocation()
Get a Location detailing the current eye position of the living entity.

Returns:
  a location at the eyes of the living entity

### getLineOfSight

@NotNull @NotNull List<Block> getLineOfSight(@Nullable @Nullable Set<Material> transparent, int maxDistance)
Gets all blocks along the living entity's line of sight.

This list contains all blocks from the living entity's eye position to target inclusive. This method considers all blocks as 1x1x1 in size.

Parameters:
  `transparent` - Set containing all transparent block Materials (set to null for only air)
  `maxDistance` - this is the maximum distance to scan (may be limited by server by at least 100 blocks, no less)
Returns:
  list containing all blocks along the living entity's line of sight

### getTargetBlock

@NotNull @NotNull Block getTargetBlock(@Nullable @Nullable Set<Material> transparent, int maxDistance)
Gets the block that the living entity has targeted.

This method considers all blocks as 1x1x1 in size. To take exact block collision shapes into account, see `getTargetBlockExact(int, FluidCollisionMode)`.

Parameters:
  `transparent` - Set containing all transparent block Materials (set to null for only air)
  `maxDistance` - this is the maximum distance to scan (may be limited by server by at least 100 blocks, no less)
Returns:
  block that the living entity has targeted

### getTargetBlock

@Nullable default @Nullable Block getTargetBlock(int maxDistance)
Gets the block that the living entity has targeted, ignoring fluids

Parameters:
  `maxDistance` - this is the maximum distance to scan
Returns:
  block that the living entity has targeted, or null if no block is within maxDistance

### getTargetBlock

@Nullable @Nullable Block getTargetBlock(int maxDistance, @NotNull TargetBlockInfo.FluidMode fluidMode)
Gets the block that the living entity has targeted

Parameters:
  `maxDistance` - this is the maximum distance to scan
  `fluidMode` - whether to check fluids or not
Returns:
  block that the living entity has targeted, or null if no block is within maxDistance

### getTargetBlockFace

@Nullable default BlockFace getTargetBlockFace(int maxDistance)
Gets the blockface of that block that the living entity has targeted, ignoring fluids

Parameters:
  `maxDistance` - this is the maximum distance to scan
Returns:
  blockface of the block that the living entity has targeted, or null if no block is targeted

### getTargetBlockFace

@Nullable BlockFace getTargetBlockFace(int maxDistance, @NotNull TargetBlockInfo.FluidMode fluidMode)
Gets the blockface of that block that the living entity has targeted

Parameters:
  `maxDistance` - this is the maximum distance to scan
  `fluidMode` - whether to check fluids or not
Returns:
  blockface of the block that the living entity has targeted, or null if no block is targeted

### getTargetBlockInfo

@Nullable default TargetBlockInfo getTargetBlockInfo(int maxDistance)
Gets information about the block the living entity has targeted, ignoring fluids

Parameters:
  `maxDistance` - this is the maximum distance to scan
Returns:
  TargetBlockInfo about the block the living entity has targeted, or null if no block is targeted

### getTargetBlockInfo

@Nullable TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull TargetBlockInfo.FluidMode fluidMode)
Gets information about the block the living entity has targeted

Parameters:
  `maxDistance` - this is the maximum distance to scan
  `fluidMode` - whether to check fluids or not
Returns:
  TargetBlockInfo about the block the living entity has targeted, or null if no block is targeted

### getTargetEntity

@Nullable default @Nullable Entity getTargetEntity(int maxDistance)
Gets information about the entity being targeted

Parameters:
  `maxDistance` - this is the maximum distance to scan
Returns:
  entity being targeted, or null if no entity is targeted

### getTargetEntity

@Nullable @Nullable Entity getTargetEntity(int maxDistance, boolean ignoreBlocks)
Gets information about the entity being targeted

Parameters:
  `maxDistance` - this is the maximum distance to scan
  `ignoreBlocks` - true to scan through blocks
Returns:
  entity being targeted, or null if no entity is targeted

### getTargetEntityInfo

@Nullable default TargetEntityInfo getTargetEntityInfo(int maxDistance)
Gets information about the entity being targeted

Parameters:
  `maxDistance` - this is the maximum distance to scan
Returns:
  TargetEntityInfo about the entity being targeted, or null if no entity is targeted

### getTargetEntityInfo

@Nullable TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks)
Gets information about the entity being targeted

Parameters:
  `maxDistance` - this is the maximum distance to scan
  `ignoreBlocks` - true to scan through blocks
Returns:
  TargetEntityInfo about the entity being targeted, or null if no entity is targeted

### getLastTwoTargetBlocks

@NotNull @NotNull List<Block> getLastTwoTargetBlocks(@Nullable @Nullable Set<Material> transparent, int maxDistance)
Gets the last two blocks along the living entity's line of sight.

The target block will be the last block in the list. This method considers all blocks as 1x1x1 in size.

Parameters:
  `transparent` - Set containing all transparent block Materials (set to null for only air)
  `maxDistance` - this is the maximum distance to scan. This may be further limited by the server, but never to less than 100 blocks
Returns:
  list containing the last 2 blocks along the living entity's line of sight

### getTargetBlockExact

@Nullable @Nullable Block getTargetBlockExact(int maxDistance)
Gets the block that the living entity has targeted.

This takes the blocks' precise collision shapes into account. Fluids are ignored.

This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.

Parameters:
  `maxDistance` - the maximum distance to scan
Returns:
  block that the living entity has targeted
See Also:
  - `getTargetBlockExact(int, org.bukkit.FluidCollisionMode)`

### getTargetBlockExact

@Nullable @Nullable Block getTargetBlockExact(int maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode)
Gets the block that the living entity has targeted.

This takes the blocks' precise collision shapes into account.

This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.

Parameters:
  `maxDistance` - the maximum distance to scan
  `fluidCollisionMode` - the fluid collision mode
Returns:
  block that the living entity has targeted
See Also:
  - `rayTraceBlocks(double, FluidCollisionMode)`

### rayTraceBlocks

@Nullable @Nullable RayTraceResult rayTraceBlocks(double maxDistance)
Performs a ray trace that provides information on the targeted block.

This takes the blocks' precise collision shapes into account. Fluids are ignored.

This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.

Parameters:
  `maxDistance` - the maximum distance to scan
Returns:
  information on the targeted block, or `null` if there is no targeted block in range
See Also:
  - `rayTraceBlocks(double, FluidCollisionMode)`

### rayTraceBlocks

@Nullable @Nullable RayTraceResult rayTraceBlocks(double maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode)
Performs a ray trace that provides information on the targeted block.

This takes the blocks' precise collision shapes into account.

This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.

Parameters:
  `maxDistance` - the maximum distance to scan
  `fluidCollisionMode` - the fluid collision mode
Returns:
  information on the targeted block, or `null` if there is no targeted block in range
See Also:
  - `World.rayTraceBlocks(Location, Vector, double, FluidCollisionMode)`

### getRemainingAir

int getRemainingAir()
Returns the amount of air that the living entity has remaining, in ticks.

Returns:
  amount of air remaining

### setRemainingAir

void setRemainingAir(int ticks)
Sets the amount of air that the living entity has remaining, in ticks.

Parameters:
  `ticks` - amount of air remaining

### getMaximumAir

int getMaximumAir()
Returns the maximum amount of air the living entity can have, in ticks.

Returns:
  maximum amount of air

### setMaximumAir

void setMaximumAir(int ticks)
Sets the maximum amount of air the living entity can have, in ticks.

Parameters:
  `ticks` - maximum amount of air

### getArrowCooldown

int getArrowCooldown()
Gets the time in ticks until the next arrow leaves the entity's body.

Returns:
  ticks until arrow leaves

### setArrowCooldown

void setArrowCooldown(int ticks)
Sets the time in ticks until the next arrow leaves the entity's body.

Parameters:
  `ticks` - time until arrow leaves

### getArrowsInBody

int getArrowsInBody()
Gets the amount of arrows in an entity's body.

Returns:
  amount of arrows in body

### setArrowsInBody

void setArrowsInBody(int count)
Set the amount of arrows in the entity's body.

Parameters:
  `count` - amount of arrows in entity's body

### getBeeStingerCooldown

int getBeeStingerCooldown()
Gets the time in ticks until the next bee stinger leaves the entity's body.

Returns:
  ticks until bee stinger leaves

### setBeeStingerCooldown

void setBeeStingerCooldown(int ticks)
Sets the time in ticks until the next stinger leaves the entity's body.

Parameters:
  `ticks` - time until bee stinger leaves

### getBeeStingersInBody

int getBeeStingersInBody()
Gets the amount of bee stingers in an entity's body.

Returns:
  amount of bee stingers in body

### setBeeStingersInBody

void setBeeStingersInBody(int count)
Set the amount of bee stingers in the entity's body.

Parameters:
  `count` - amount of bee stingers in entity's body

### getMaximumNoDamageTicks

int getMaximumNoDamageTicks()
Returns the living entity's current maximum no damage ticks.

This is the maximum duration in which the living entity will not take damage.

Returns:
  maximum no damage ticks

### setMaximumNoDamageTicks

void setMaximumNoDamageTicks(int ticks)
Sets the living entity's current maximum no damage ticks.

Parameters:
  `ticks` - maximum amount of no damage ticks

### getLastDamage

double getLastDamage()
Returns the living entity's last damage taken in the current no damage ticks time.

Only damage higher than this amount will further damage the living entity.

Returns:
  damage taken since the last no damage ticks time period

### setLastDamage

void setLastDamage(double damage)
Sets the damage dealt within the current no damage ticks time period.

Parameters:
  `damage` - amount of damage

### getNoDamageTicks

int getNoDamageTicks()
Returns the living entity's current no damage ticks.

Returns:
  amount of no damage ticks

### setNoDamageTicks

void setNoDamageTicks(int ticks)
Sets the living entity's current no damage ticks.

Parameters:
  `ticks` - amount of no damage ticks

### getKiller

@Nullable @Nullable Player getKiller()
Gets the player identified as the killer of the living entity.

May be null.

Returns:
  killer player, or null if none found

### setKiller

void setKiller(@Nullable @Nullable Player killer)
Sets the player identified as the killer of the living entity.

Parameters:
  `killer` - player

### addPotionEffect

boolean addPotionEffect(@NotNull @NotNull PotionEffect effect)
Adds the given `PotionEffect` to the living entity.

Parameters:
  `effect` - PotionEffect to be added
Returns:
  whether the effect could be added

### addPotionEffect

@Deprecated boolean addPotionEffect(@NotNull @NotNull PotionEffect effect, boolean force)
Deprecated.
no need to force since multiple effects of the same type are now supported.
Adds the given `PotionEffect` to the living entity.

Only one potion effect can be present for a given `PotionEffectType`.

Parameters:
  `effect` - PotionEffect to be added
  `force` - whether conflicting effects should be removed
Returns:
  whether the effect could be added

### addPotionEffects

boolean addPotionEffects(@NotNull @NotNull Collection<PotionEffect> effects)
Attempts to add all of the given `PotionEffect` to the living entity.

Parameters:
  `effects` - the effects to add
Returns:
  whether all of the effects could be added

### hasPotionEffect

boolean hasPotionEffect(@NotNull @NotNull PotionEffectType type)
Returns whether the living entity already has an existing effect of the given `PotionEffectType` applied to it.

Parameters:
  `type` - the potion type to check
Returns:
  whether the living entity has this potion effect active on them

### getPotionEffect

@Nullable @Nullable PotionEffect getPotionEffect(@NotNull @NotNull PotionEffectType type)
Returns the active `PotionEffect` of the specified type.

If the effect is not present on the entity then null will be returned.

Parameters:
  `type` - the potion type to check
Returns:
  the effect active on this entity, or null if not active.

### removePotionEffect

void removePotionEffect(@NotNull @NotNull PotionEffectType type)
Removes any effects present of the given `PotionEffectType`.

Parameters:
  `type` - the potion type to remove

### getActivePotionEffects

@NotNull @NotNull Collection<PotionEffect> getActivePotionEffects()
Returns all currently active `PotionEffect`s on the living entity.

Returns:
  a collection of `PotionEffect`s

### hasLineOfSight

boolean hasLineOfSight(@NotNull @NotNull Entity other)
Checks whether the living entity has block line of sight to another.

This uses the same algorithm that hostile mobs use to find the closest player.

Parameters:
  `other` - the entity to determine line of sight to
Returns:
  true if there is a line of sight, false if not

### hasLineOfSight

boolean hasLineOfSight(@NotNull @NotNull Location location)
Checks whether the living entity has block line of sight to the given block.

This uses the same algorithm that hostile mobs use to find the closest player.

Parameters:
  `location` - the location to determine line of sight to
Returns:
  true if there is a line of sight, false if not

### getRemoveWhenFarAway

boolean getRemoveWhenFarAway()
Returns if the living entity despawns when away from players or not.

By default, animals are not removed while other mobs are.

Returns:
  true if the living entity is removed when away from players

### setRemoveWhenFarAway

void setRemoveWhenFarAway(boolean remove)
Sets whether or not the living entity despawns when away from players or not.

Parameters:
  `remove` - the removal status

### getEquipment

@Nullable @Nullable EntityEquipment getEquipment()
Gets the inventory with the equipment worn by the living entity.

Returns:
  the living entity's inventory

### setCanPickupItems

void setCanPickupItems(boolean pickup)
Sets whether or not the living entity can pick up items.

Parameters:
  `pickup` - whether or not the living entity can pick up items

### getCanPickupItems

boolean getCanPickupItems()
Gets if the living entity can pick up items.

Returns:
  whether or not the living entity can pick up items

### isLeashed

boolean isLeashed()
Returns whether the entity is currently leashed.

Returns:
  whether the entity is leashed

### getLeashHolder

@NotNull @NotNull Entity getLeashHolder() throws IllegalStateException
Gets the entity that is currently leading this entity.

Returns:
  the entity holding the leash
Throws:
  `IllegalStateException` - if not currently leashed

### setLeashHolder

boolean setLeashHolder(@Nullable @Nullable Entity holder)
Sets the leash on this entity to be held by the supplied entity.

This method has no effect on EnderDragons, Withers, Players, or Bats. Non-living entities excluding leashes will not persist as leash holders.

Parameters:
  `holder` - the entity to leash this entity to, or null to unleash
Returns:
  whether the operation was successful

### isGliding

boolean isGliding()
Checks to see if an entity is gliding, such as using an Elytra.

Returns:
  True if this entity is gliding.

### setGliding

void setGliding(boolean gliding)
Makes entity start or stop gliding. This will work even if an Elytra is not equipped, but will be reverted by the server immediately after unless an event-cancelling mechanism is put in place.

Parameters:
  `gliding` - True if the entity is gliding.

### isSwimming

boolean isSwimming()
Checks to see if an entity is swimming.

Returns:
  True if this entity is swimming.

### setSwimming

void setSwimming(boolean swimming)
Makes entity start or stop swimming. This may have unexpected results if the entity is not in water.

Parameters:
  `swimming` - True if the entity is swimming.

### isRiptiding

boolean isRiptiding()
Checks to see if an entity is currently using the Riptide enchantment.

Returns:
  True if this entity is currently riptiding.

### isSleeping

boolean isSleeping()
Returns whether this entity is slumbering.

Returns:
  slumber state

### isClimbing

boolean isClimbing()
Gets if the entity is climbing.

Returns:
  if the entity is climbing

### setAI

void setAI(boolean ai)
Sets whether an entity will have AI. The entity will be completely unable to move if it has no AI.

Parameters:
  `ai` - whether the mob will have AI or not.

### hasAI

boolean hasAI()
Checks whether an entity has AI. The entity will be completely unable to move if it has no AI.

Returns:
  true if the entity has AI, otherwise false.

### attack

void attack(@NotNull @NotNull Entity target)
Makes this entity attack the given entity with a melee attack. Attack damage is calculated by the server from the attributes and equipment of this mob, and knockback is applied to `target` as appropriate.

Parameters:
  `target` - entity to attack.

### swingMainHand

void swingMainHand()
Makes this entity swing their main hand. This method does nothing if this entity does not have an animation for swinging their main hand.

### swingOffHand

void swingOffHand()
Makes this entity swing their off hand. This method does nothing if this entity does not have an animation for swinging their off hand.

### setCollidable

void setCollidable(boolean collidable)
Set if this entity will be subject to collisions with other entities.

Exemptions to this rule can be managed with `getCollidableExemptions()`

Parameters:
  `collidable` - collision status

### isCollidable

boolean isCollidable()
Gets if this entity is subject to collisions with other entities.

Some entities might be exempted from the collidable rule of this entity. Use `getCollidableExemptions()` to get these.

Please note that this method returns only the custom collidable state, not whether the entity is non-collidable for other reasons such as being dead.

Returns:
  collision status

### getCollidableExemptions

@NotNull @NotNull Set<UUID> getCollidableExemptions()
Gets a mutable set of UUIDs of the entities which are exempt from the entity's collidable rule and which's collision with this entity will behave the opposite of it.

This set can be modified to add or remove exemptions.

For example if collidable is true and an entity is in the exemptions set then it will not collide with it. Similarly if collidable is false and an entity is in this set then it will still collide with it.

Note these exemptions are not (currently) persistent.

Returns:
  the collidable exemption set

### getMemory

@Nullable <T> T getMemory(@NotNull @NotNull MemoryKey<T> memoryKey)
Returns the value of the memory specified.

Note that the value is null when the specific entity does not have that value by default.

Type Parameters:
  `T` - the type of the return value
Parameters:
  `memoryKey` - memory to access
Returns:
  a instance of the memory section value or null if not present

### setMemory

<T> void setMemory(@NotNull @NotNull MemoryKey<T> memoryKey, @Nullable T memoryValue)
Sets the value of the memory specified.

Note that the value will not be persisted when the specific entity does not have that value by default.

Type Parameters:
  `T` - the type of the passed value
Parameters:
  `memoryKey` - the memory to access
  `memoryValue` - a typed memory value

### getCategory

@NotNull @NotNull EntityCategory getCategory()
Get the category to which this entity belongs. Categories may subject this entity to additional effects, benefits or debuffs.

Returns:
  the entity category

### setInvisible

void setInvisible(boolean invisible)
Sets whether the entity is invisible or not.

Parameters:
  `invisible` - If the entity is invisible

### isInvisible

boolean isInvisible()
Gets whether the entity is invisible or not.

Returns:
  Whether the entity is invisible

### getArrowsStuck

int getArrowsStuck()
Get the number of arrows stuck in this entity

Returns:
  Number of arrows stuck

### setArrowsStuck

void setArrowsStuck(int arrows)
Set the number of arrows stuck in this entity

Parameters:
  `arrows` - Number of arrows to stick in this entity

### getShieldBlockingDelay

int getShieldBlockingDelay()
Get the delay (in ticks) before blocking is effective for this entity

Returns:
  Delay in ticks

### setShieldBlockingDelay

void setShieldBlockingDelay(int delay)
Set the delay (in ticks) before blocking is effective for this entity

Parameters:
  `delay` - Delay in ticks

### getActiveItem

@Nullable @Nullable ItemStack getActiveItem()
Get's the item being actively "used" or consumed.

Returns:
  The item. Will be null if no active item.

### clearActiveItem

void clearActiveItem()
Interrupts any ongoing active "usage" or consumption or an item.

### getItemUseRemainingTime

int getItemUseRemainingTime()
Get's remaining time a player needs to keep hands raised with an item to finish using it.

Returns:
  Remaining ticks to use the item

### getHandRaisedTime

int getHandRaisedTime()
Get how long the players hands have been raised (Charging Bow attack, using a potion, etc)

Returns:
  Get how long the players hands have been raised (Charging Bow attack, using a potion, etc)

### isHandRaised

boolean isHandRaised()
Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food)

Returns:
  Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food)

### getHandRaised

@NotNull EquipmentSlot getHandRaised()
Gets the hand raised by this living entity. Will be either `EquipmentSlot.HAND` or `EquipmentSlot.OFF_HAND`.

Returns:
  the hand raised

### isJumping

boolean isJumping()
Get entity jump state.

Jump state will be true when the entity has been marked to jump.

Returns:
  entity jump state.

### setJumping

void setJumping(boolean jumping)
Set entity jump state

Setting to true will mark the entity to jump.

Setting to false will unmark the entity to jump but will not stop a jump already in-progress.

Parameters:
  `jumping` - entity jump state

### playPickupItemAnimation

default void playPickupItemAnimation(@NotNull @NotNull Item item)
Plays pickup item animation towards this entity.

This will remove the item on the client.

Quantity is inferred to be that of the `Item`.

Parameters:
  `item` - item to pickup

### playPickupItemAnimation

void playPickupItemAnimation(@NotNull @NotNull Item item, int quantity)
Plays pickup item animation towards this entity.

This will remove the item on the client.

Parameters:
  `item` - item to pickup
  `quantity` - quantity of item

### getHurtDirection

float getHurtDirection()
Gets player hurt direction

Returns:
  hurt direction

### setHurtDirection

void setHurtDirection(float hurtDirection)
Sets player hurt direction

Parameters:
  `hurtDirection` - hurt direction