> For the complete documentation index, see [llms.txt](https://edseries-plugins.gitbook.io/p/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://edseries-plugins.gitbook.io/p/pinnaprison/developers/edlib-api/entities.md).

# Entities

`EdEntity` is the core interface for a **client-only** (packet-based) entity. It exists only for the players you add as watchers — never on the server — so it has no AI, no collisions and no persistence. You move it and animate it yourself (usually with [goals](/p/pinnaprison/developers/edlib-api/goals.md)).

```java
EdEntity entity = EdLibAPI.getInstance().createEntity(EntityType.ZOMBIE, location);
entity.setDisplayName("§cGuard");
entity.setGlowing(EdColor.RED);
entity.addWatcher(player);
entity.spawn();
```

## Lifecycle & visibility

Nothing shows until the entity has at least one watcher **and** has been spawned.

| Method                             |                                      |
| ---------------------------------- | ------------------------------------ |
| `void addWatcher(Player p)`        | Make the entity visible to a player. |
| `void removeWatcher(Player p)`     | Hide it from a player.               |
| `Collection<Player> getWatchers()` | Everyone who can currently see it.   |
| `void spawn()`                     | Spawn for all current watchers.      |
| `void spawnForPlayer(Player p)`    | Spawn for one player only.           |
| `void remove()`                    | Remove for all watchers.             |
| `void removeForPlayer(Player p)`   | Remove for one player.               |

{% hint style="warning" %}
Adding a watcher after `spawn()` does **not** auto-spawn for them — call `spawnForPlayer(p)` too. Always `remove()` (or schedule a cleanup) when finished; client-only entities are not cleaned up for you.
{% endhint %}

## Identity

| Method                 |                                                                         |
| ---------------------- | ----------------------------------------------------------------------- |
| `Integer getId()`      | The numeric entity id used in packets.                                  |
| `UUID getUUID()`       | The entity UUID.                                                        |
| `EntityType getType()` | The Bukkit entity type.                                                 |
| `Object getEntity()`   | The raw NMS entity (advanced/version-specific — avoid unless you must). |

## Appearance

| Method                                                        |                                                                                                                          |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `void setDisplayName(String name)`                            | The name tag above the entity (color codes supported).                                                                   |
| `void setText(List<String> text)`                             | For **text displays**: updates the lines in place via a metadata packet — no despawn/flicker. No-op otherwise.           |
| `void setGlowing(EdColor color)`                              | Outline-glow the entity in a color.                                                                                      |
| `void setInvisible()`                                         | Make it invisible (e.g. to show only its name or equipment).                                                             |
| `void setInFire(boolean)`                                     | Toggle the on-fire visual.                                                                                               |
| `void setSmall()`                                             | Armor-stand "small" flag.                                                                                                |
| `void setScale(float scale)`                                  | Scale via the `minecraft:scale` attribute (`1` = normal). 1.21+/26.1+ only; no-op on 1.20.4.                             |
| `void setGravity(boolean)`                                    | Client-side gravity. Only matters for entities you let the client simulate; packet-driven entities normally use `false`. |
| `void setEquipment(EntityEquipmentSlot slot, ItemStack item)` | Put an item in a slot (hand, armor…).                                                                                    |
| `void playAnimation(EntityAnimation animation)`               | Play a one-shot animation (e.g. arm swing).                                                                              |
| `void damageEffect()`                                         | The red "hurt" flash + sound.                                                                                            |
| `void setSheepColor(EdColor color)`                           | Wool color (sheep only).                                                                                                 |
| `void setSlimeSize(int size)`                                 | Slime/magma-cube size.                                                                                                   |
| `void setDinnerbone(boolean)` / `boolean isDinnerbone()`      | Render upside-down (the "Dinnerbone" easter egg, living entities only).                                                  |
| `float getNameHeight()`                                       | Y-offset where the name tag floats.                                                                                      |

## Movement & rotation

Positions are world coordinates. For smooth animation use `shortTp` every tick (it sends a relative-move packet); use `tp` for longer jumps.

| Method                                                                   |                                                              |
| ------------------------------------------------------------------------ | ------------------------------------------------------------ |
| `Vector getPosition()` / `Vector getLocVector()`                         | Current position.                                            |
| `void tp(double x, y, z)`                                                | Teleport (absolute).                                         |
| `void shortTp(double x, y, z)`                                           | Short relative move — optimised for per-tick animation.      |
| `void rotateBodyAndMove(double x, y, z, float yaw, float pitch)`         | Move and rotate in one packet.                               |
| `void setNMSLocation(double x, y, z, float yaw, float pitch)`            | Set the backing location without sending a move (low-level). |
| `void setYaw(float)` / `void setYawHead(float)` / `void setPitch(float)` | Set individual rotation components.                          |
| `void rotateBody(float yaw, float pitch)`                                | Rotate body (+ head pitch).                                  |
| `void rotateHead(float yaw)`                                             | Rotate only the head.                                        |

## Transformations (displays)

For block/item displays you animate a 4×4 matrix instead of moving the entity. Interpolation makes the client tween between matrices smoothly.

| Method                                                                                   |                                             |
| ---------------------------------------------------------------------------------------- | ------------------------------------------- |
| `void setTransformation(Matrix4f matrix)`                                                | Apply a transform instantly.                |
| `void setTransformationWithInterpolation(Matrix4f matrix, int durationTicks)`            | Tween to a transform over `duration` ticks. |
| `void setTransformationWithInterpolation(Matrix4f matrix, int duration, int startDelay)` | …with a start delay.                        |
| `void setInterpolationDuration(int ticks)`                                               | Default tween duration.                     |
| `void startInterpolation()`                                                              | Manually begin interpolation.               |

## Passengers

| Method                                          |                                 |
| ----------------------------------------------- | ------------------------------- |
| `void addPassenger(EdEntity entity)`            | Stack an entity on top (rider). |
| `void setPassengers(List<EdEntity> passengers)` | Replace the passenger list.     |

## Goals

Entities run [goals](/p/pinnaprison/developers/edlib-api/goals.md) from a queue, one at a time:

```java
entity.addGoal(new EdGoalMove(new Vector(10, 64, 5), 0.2));
entity.addGoal(new EdGoalDelay(40));
entity.addGoal(new EdGoalMove(new Vector(0, 64, 0), 0.2));
```

`addGoal`, `startNextGoal`, `onGoalComplete`, `getGoalQueue`, `getCurrentGoal`, `setCurrentGoal`, `clearGoals`, `skipCurrentGoal`. See [Goals](/p/pinnaprison/developers/edlib-api/goals.md).

***

## Specialised entity types

`createEntity` returns the matching subtype — cast the result.

### EdFallingBlock

A free-floating block visual (great for projectiles/debris — what Meteor Shower uses).

```java
EdFallingBlock rock = (EdFallingBlock) edlib.createEntity(EntityType.FALLING_BLOCK, loc);
rock.setFallingBlock(Material.MAGMA_BLOCK); // the block to show
rock.setGravity(false);                     // you drive it with goals
```

`Material getBlockMaterial()`, `void setFallingBlock(Material mat)`.

### EdPrimedTNT

```java
EdPrimedTNT tnt = (EdPrimedTNT) edlib.createEntity(EntityType.TNT, loc);
tnt.setFuseTicks(40);            // flashes faster as the fuse runs down
tnt.setMaterial(Material.TNT);   // the block texture it shows
```

`long getFuseTicks()` / `setFuseTicks(long)`, `Material getMaterial()` / `setMaterial(Material)`.

### EdNPC

A packet player NPC. The name above the head is the **profile name** (max 16 chars, legacy color codes), fixed at creation. `setDisplayName` here changes the *tab-list* name, not the head name — hide the head name with `setNameTagVisible(false)` and use a text-display passenger if you need a richer label.

```java
EdNPC npc = edlib.createNPC(loc, "§bQuest Giver", texture, signature);
npc.setTabListed(false);          // hidden from the tab list (skin still loads)
npc.addWatcher(player);
npc.spawn();
npc.lookAt(player.getLocation().toVector());
```

| Method                                                             |                                              |
| ------------------------------------------------------------------ | -------------------------------------------- |
| `String getProfileName()`                                          | The head name.                               |
| `void setSkin(String texture, String signature)`                   | Swap the skin (respawns if already spawned). |
| `void setSkinParts(byte parts)` / `setSecondLayerVisible(boolean)` | Toggle skin overlay layers (`0x7F` = all).   |
| `void setTabListed(boolean)` / `isTabListed()`                     | Show/hide in tab list.                       |
| `void setTabName(String)`                                          | Tab-list name (`null` = profile name).       |
| `void setNameTagVisible(boolean)` / `isNameTagVisible()`           | Show/hide the head name tag.                 |
| `void setSneaking(boolean)` / `isSneaking()`                       | Sneak pose.                                  |
| `void lookAt(double x, y, z)` / `lookAt(Vector)`                   | Rotate body + head toward a point.           |

{% hint style="info" %}
Get a `texture`/`signature` pair from any skin source (e.g. mineskin.org or a Mojang profile lookup). The signature is required for the skin to render for online-mode clients.
{% endhint %}

### EdLivingEntity

A marker interface for living packet entities; all the appearance/movement methods above apply.

***

## Enums

**`EntityEquipmentSlot`** — `MAIN_HAND`, `OFF_HAND`, `BOOTS`, `LEGGINGS`, `CHESTPLATE`, `HELMET`, `BODY`, `SADDLE`.

**`EntityAnimation`** — `SWING_MAIN_HAND`, `SWING_OFF_HAND`, `LEAVE_BED`, `CRITICAL_EFFECT`, `MAGIC_CRITICAL_EFFECT`.

**`EdColor`** — `BLACK`, `DARK_BLUE`, `DARK_GREEN`, `DARK_AQUA`, `DARK_RED`, `DARK_PURPLE`, `GOLD`, `GRAY`, `DARK_GRAY`, `BLUE`, `GREEN`, `AQUA`, `RED`, `LIGHT_PURPLE`, `YELLOW`, `WHITE`, `ORANGE`, `MAGENTA`, `LIGHT_BLUE`, `LIME`, `PINK`, `LIGHT_GRAY`, `CYAN`, `PURPLE`, `BROWN` (used by `setGlowing` and `setSheepColor`).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://edseries-plugins.gitbook.io/p/pinnaprison/developers/edlib-api/entities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
