> For the complete documentation index, see [llms.txt](https://daikirai.gitbook.io/scripting/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://daikirai.gitbook.io/scripting/documentation/entity.md).

# entity

{% hint style="info" %}
assumes variable `entity` is defined.

example: `Entity entity = client.getPlayer();`
{% endhint %}

## Entity

`Entity` represents an entity in the world with its properties and data.

| property | type      | description                                     |
| -------- | --------- | ----------------------------------------------- |
| type     | `String`  | simple class name of the entity                 |
| entityId | `int`     | entity id in the world                          |
| isLiving | `boolean` | `true` if the entity extends `EntityLivingBase` |
| isPlayer | `boolean` | `true` if the entity is a player                |
| isUser   | `boolean` | `true` if the entity is the local player        |

***

### distanceToGround

returns the distance from the entity to the ground.

```java
double distance = entity.distanceToGround();
```

***

### getAbsorption

returns the absorption amount, or `-1` for non-living entities.

```java
float absorption = entity.getAbsorption();
```

***

### getArmorInSlot

returns the armor item in the specified slot as an [`ItemStack`](/scripting/documentation/itemstack.md). valid slots are `0-3`.

```java
ItemStack armor = entity.getArmorInSlot(int slot);
```

***

### getBlockPosition

returns the entity's block position as a [`Vec3`](/scripting/documentation/vec3.md).

```java
Vec3 blockPos = entity.getBlockPosition();
```

***

### getBPS

returns the entity's speed in blocks per second.

```java
double bps = entity.getBPS();
```

***

### getDisplayName

returns the display name of the entity.

```java
String displayName = entity.getDisplayName();
```

***

### getEyeHeight

returns the eye height.

```java
float eyeHeight = entity.getEyeHeight();
```

***

### getFallDistance

returns the fall distance.

```java
float fall = entity.getFallDistance();
```

***

### getFacing

returns the horizontal facing direction.

```java
String facing = entity.getFacing();
```

***

### getHealth

returns the current health, or `-1` for non-living entities.

```java
float health = entity.getHealth();
```

***

### getHeldItem

returns the held item as an [`ItemStack`](/scripting/documentation/itemstack.md), or `null` when empty.

```java
ItemStack held = entity.getHeldItem();
```

***

### getHeight

returns the entity height.

```java
float height = entity.getHeight();
```

***

### getHurtTime

returns the hurt time, or `-1` for non-living entities.

```java
int hurtTime = entity.getHurtTime();
```

***

### getLastPosition

returns the previous tick position as a [`Vec3`](/scripting/documentation/vec3.md).

```java
Vec3 previous = entity.getLastPosition();
```

***

### getMaxHealth

returns the maximum health, or `-1` for non-living entities.

```java
float maxHealth = entity.getMaxHealth();
```

***

### getMaxHurtTime

returns the maximum hurt time, or `-1` for non-living entities.

```java
int maxHurt = entity.getMaxHurtTime();
```

***

### getMoveAttribute

returns current movement speed attribute `getAIMoveSpeed`, or `-1` for non-player entities.

```java
float moveAttr = entity.getMoveAttribute();
```

***

### getName

returns the registry or display name of the entity.

```java
String name = entity.getName();
```

***

### getNetworkPlayer

returns the [`NetworkPlayer`](/scripting/documentation/network.md) wrapper for this entity.

```java
NetworkPlayer info = entity.getNetworkPlayer();
```

***

### getPitch

returns the entity pitch.

```java
float pitch = entity.getPitch();
```

***

### getPosition

returns the current position as a [`Vec3`](/scripting/documentation/vec3.md).

```java
Vec3 position = entity.getPosition();
```

***

### getPotionEffects

returns active potion effects as a list of `[id, name, amplifier, duration]`, or `null` when none.

```java
List<Object[]> effects = entity.getPotionEffects();
```

***

### getPrevPitch

returns the entity's previous pitch.

```java
float prevPitch = entity.getPrevPitch();
```

***

### getPrevYaw

returns the entity's previous yaw.

```java
float prevYaw = entity.getPrevYaw();
```

***

### getSpeed

returns the horizontal movement speed per tick.

```java
double speed = entity.getSpeed();
```

***

### getStackSize

returns the stack size, or `-1` if not of type `EntityItem`.

```java
int stackSuze = entity.getStackSize();
```

***

### getSwingProgress

returns the swing progress tick count, or `-1` for non-living entities.

```java
int swing = entity.getSwingProgress();
```

***

### getTicksExisted

returns the ticks existed value.

```java
int ticks = entity.getTicksExisted();
```

***

### getUUID

returns the entity uuid as a string.

```java
String uuid = entity.getUUID();
```

***

### getWidth

returns the entity width.

```java
float width = entity.getWidth();
```

***

### getYaw

returns the entity yaw.

```java
float yaw = entity.getYaw();
```

***

### isBurning

returns `true` if the entity is burning.

```java
boolean burning = entity.isBurning();
```

***

### isCollided

returns `true` if the entity is colliding.

```java
boolean collided = entity.isCollided();
```

***

### isCollidedHorizontally

returns `true` if the entity collides horizontally.

```java
boolean collidedHoriz = entity.isCollidedHorizontally();
```

***

### isCollidedVertically

returns `true` if the entity collides vertically.

```java
boolean collidedVert = entity.isCollidedVertically();
```

***

### isConsuming

returns `true` if the player entity is consuming an item.

```java
boolean consuming = entity.isConsuming();
```

***

### isDead

returns `true` if the entity is dead.

```java
boolean dead = entity.isDead();
```

***

### isHoldingBlock

returns `true` if the entity is holding a block item.

```java
boolean holdingBlock = entity.isHoldingBlock();
```

***

### isHoldingSword

returns `true` if the entity is holding a sword.

```java
boolean holdingSword = entity.isHoldingSword();
```

***

### isHoldingWeapon

returns `true` if the entity is holding a weapon recognised by raven.

```java
boolean holdingWeapon = entity.isHoldingWeapon();
```

***

### isInvisible

returns `true` if the entity is invisible.

```java
boolean invisible = entity.isInvisible();
```

***

### isInLava

returns `true` if the entity is in lava.

```java
boolean inLava = entity.isInLava();
```

***

### isInLiquid

returns `true` if the entity is in water or lava.

```java
boolean inLiquid = entity.isInLiquid();
```

***

### isInWater

returns `true` if the entity is in water.

```java
boolean inWater = entity.isInWater();
```

***

### isOnEdge

returns `true` if the entity is standing on an edge.

```java
boolean onEdge = entity.isOnEdge();
```

***

### onGround

returns `true` if the entity is on the ground.

```java
boolean grounded = entity.onGround();
```

***

### isOnLadder

returns `true` if the entity is on a ladder.

```java
boolean onLadder = entity.isOnLadder();
```

***

### isRiding

returns `true` if the entity is riding another entity.

```java
boolean riding = entity.isRiding();
```

***

### isSleeping

returns `true` if the player entity is sleeping.

```java
boolean sleeping = entity.isSleeping();
```

***

### isSneaking

returns `true` if the entity is sneaking.

```java
boolean sneaking = entity.isSneaking();
```

***

### isSprinting

returns `true` if the entity is sprinting.

```java
boolean sprinting = entity.isSprinting();
```

***

### isSwinging

returns `true` if the entity is currently swinging.

```java
boolean swinging = entity.isSwinging();
```

***

### isUsingItem

returns `true` if the player entity is using an item.

```java
boolean usingItem = entity.isUsingItem();
```

***

### setPitch

sets the entity pitch.

```java
entity.setPitch(float pitch);
```

***

### setPosition

sets the entity position.

```java
entity.setPosition(Vec3 position);
entity.setPosition(double x, double y, double z);
```

***

### setPrevPitch

sets the entity's previous pitch.

```java
entity.setPrevPitch(float prevPitch);
```

***

### setPrevYaw

sets the entity's previous yaw.

```java
entity.setPrevYaw(float prevYaw);
```

***

### setYaw

sets the entity yaw.

```java
entity.setYaw(float yaw);
```
