> For the complete documentation index, see [llms.txt](https://docs.quickclient.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.quickclient.cc/en/game/entities.md).

# Entities

Finding players and mobs nearby and reading data about each entity.

`entities()` finds entities around the player: other players, mobs and everything else. Each entity is returned in an `Entity` wrapper.

The wrapper only stores the entity's network id, and Quick looks the entity up by that id again on every access. This keeps the data up to date. If the entity leaves the world, `valid()` returns `false` and all getters return zeros.

```java
for (Entity entity : entities().players(16.0)) {
    if (!entity.self() && !entity.friend()) {
        render.entityBox(entity, 0xFFFF3B30, true);
    }
}

Entity target = entities().target();
if (target != null && target.distance() < 4.0) {
    interaction().attack(target);
}
```

**How it works**

* The first loop draws a red box around every player within 16 blocks, except yourself and your friends.
* Then it takes the combat modules' target and attacks it if it is closer than 4 blocks.

## Entities

| Method           | Type       | Description                                                                                      |
| ---------------- | ---------- | ------------------------------------------------------------------------------------------------ |
| `of(id)`         | `Entity`   | wrapper by network id; if there is no such entity, `valid()` returns `false`                     |
| `all(range)`     | `Entity[]` | all entities within range, closest first                                                         |
| `players(range)` | `Entity[]` | players, excluding yourself                                                                      |
| `living(range)`  | `Entity[]` | all living entities, excluding yourself                                                          |
| `target()`       | `Entity`   | the combat modules' target: aura attacks it and TargetHud shows it; `null` if there is no target |
| `crosshair()`    | `Entity`   | the entity under the crosshair or `null`                                                         |

Arrays are built again on every call. When rendering, get them once per frame and keep working with the stored variable.

## Entity

| Method                                                                             | Type      | Description                                                                                                    |
| ---------------------------------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------- |
| `id()`                                                                             | `int`     | network id                                                                                                     |
| `valid()`                                                                          | `boolean` | whether the entity is in the world right now                                                                   |
| `name()`                                                                           | `String`  | name without colors or formatting                                                                              |
| `displayName()`                                                                    | `Text`    | name with team color and prefixes, drawn in parts                                                              |
| `type()`                                                                           | `String`  | type, for example `"minecraft:zombie"`                                                                         |
| `uuid()`                                                                           | `String`  | uuid with dashes                                                                                               |
| `skin()`                                                                           | `String`  | skin texture path; until the skin loads, Steve or Alex is returned                                             |
| `x()`, `y()`, `z()`                                                                | `double`  | position; `y` is the bottom of the hitbox                                                                      |
| `position()`                                                                       | `Point`   | the same as one point                                                                                          |
| `position(delta)`                                                                  | `Point`   | smooth position for rendering                                                                                  |
| `motion()`                                                                         | `Point`   | velocity                                                                                                       |
| `yaw()`, `pitch()`                                                                 | `float`   | where the head is turned                                                                                       |
| `width()`, `height()`                                                              | `float`   | hitbox size                                                                                                    |
| `distance()`                                                                       | `double`  | distance to your player                                                                                        |
| `health()`                                                                         | `float`   | health as Quick sees it; if the module that reads health from the scoreboard is on, the value comes from there |
| `maxHealth()`, `absorption()`                                                      | `float`   | max health and golden hearts                                                                                   |
| `hurtTime()`                                                                       | `int`     | how many ticks the hurt animation has left                                                                     |
| `alive()`                                                                          | `boolean` | whether the entity is alive                                                                                    |
| `player()`, `living()`                                                             | `boolean` | whether it is a player, whether it is a living entity                                                          |
| `self()`                                                                           | `boolean` | it is your own player                                                                                          |
| `friend()`                                                                         | `boolean` | on the Quick friends list                                                                                      |
| `sneaking()`, `sprinting()`, `onGround()`, `invisible()`, `inWater()`, `gliding()` | `boolean` | what the entity is doing right now                                                                             |
| `held()`, `offhand()`                                                              | `Item`    | what is in its hands                                                                                           |
| `armor(part)`                                                                      | `Item`    | armor: `Entity.HEAD`, `CHEST`, `LEGS`, `FEET`                                                                  |

`equals` and `hashCode` compare wrappers by id, so you can put them in a `Set` or `Map`.

`Script` also has an old `target()` method. It returns the vanilla object typed as `Object`, and game classes are not available to scripts, so it cannot be used. Use `entities().target()` instead.


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.quickclient.cc/en/game/entities.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
