> For the complete documentation index, see [llms.txt](https://enchantedmobs.superiormc.cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://enchantedmobs.superiormc.cn/configs/power-conditions/entity-state.md).

# Entity and State Conditions

Every registered condition on this page is documented as an independent reference entry. All entries also support the common condition fields documented on the [Power Conditions](/configs/power-conditions.md) page.

## Registry keys on this page

* `headshot`
* `height`
* `sneaking`
* `not_sneaking`
* `health`
* `health_percent`
* `has_potion`
* `distance`
* `food_level`
* `gliding`
* `on_ground`
* `in_air`
* `match_entity`
* `first_attack_against_entity`

***

## `headshot`

**Purpose:** Checks whether the current projectile is vertically close to the target's eye position.

**Context:** Requires a living `TARGET` and projectile `SKILL`; these roles are fixed by the implementation.

### Fields

| Field       | Default | Description                                                                        |
| ----------- | ------- | ---------------------------------------------------------------------------------- |
| `tolerance` | `0.45`  | Maximum absolute Y difference between projectile location and target eye location. |

### Example

```yaml
type: headshot
tolerance: 0.4
```

### Behavior and limits

* Only vertical position is checked; this is not an exact hitbox intersection test.
* Use it on projectile damage or hit triggers that provide both roles.

***

## `height`

**Purpose:** Checks the block Y coordinate of the resolved trigger location.

**Context:** Uses `PowerContext.location()` rather than an entity selector.

### Fields

| Field | Default         | Description          |
| ----- | --------------- | -------------------- |
| `min` | minimum integer | Inclusive minimum Y. |
| `max` | maximum integer | Inclusive maximum Y. |

### Example

```yaml
type: height
min: 60
max: 100
```

### Behavior and limits

* This condition uses only `min` and `max`; it does not use the shared numeric `compare` form.

***

## `sneaking`

**Purpose:** Checks whether a selected player is sneaking.

**Context:** Default `target`: `TARGET`; the selected entity must be a player.

### Fields

| Field    | Default  | Description              |
| -------- | -------- | ------------------------ |
| `target` | `TARGET` | Entity selector.         |
| `value`  | `true`   | Expected sneaking state. |

### Example

```yaml
type: sneaking
target: SOURCE
value: true
```

### Behavior and limits

* Non-player entities do not match.

***

## `not_sneaking`

**Purpose:** Matches a selected player that is not sneaking.

**Context:** Default `target`: `TARGET`; the selected entity must be a player.

### Fields

| Field    | Default  | Description      |
| -------- | -------- | ---------------- |
| `target` | `TARGET` | Entity selector. |

### Example

```yaml
type: not_sneaking
target: SOURCE
```

### Behavior and limits

* Equivalent to `sneaking` with `value: false` for player targets.

***

## `health`

**Purpose:** Checks current or maximum health with the shared numeric-comparison syntax.

**Context:** Default `target`: `TARGET`; requires a living entity.

### Fields

| Field             | Default   | Description                                       |
| ----------------- | --------- | ------------------------------------------------- |
| `target`          | `TARGET`  | Entity selector.                                  |
| `mode`            | `CURRENT` | `CURRENT`, `MAX`, or `MAXIMUM`.                   |
| `min / max`       | unbounded | Inclusive numeric range.                          |
| `compare / value` | unset     | Alternative comparison such as `>=`, `<`, or `=`. |

### Example

```yaml
type: health
target: SOURCE
mode: CURRENT
compare: '<='
value: 10
```

### Behavior and limits

* The checked value is exposed as `{original}` and `{current}` while resolving numeric fields.

***

## `health_percent`

**Purpose:** Checks current health as a percentage of maximum health.

**Context:** Default `target`: `TARGET`; requires a living entity.

### Fields

| Field            | Default   | Description                             |
| ---------------- | --------- | --------------------------------------- |
| `target`         | `TARGET`  | Entity selector.                        |
| `min`            | `0`       | Inclusive minimum percent.              |
| `max`            | `100`     | Inclusive maximum percent.              |
| `min-max-health` | `0`       | Inclusive minimum maximum-health value. |
| `max-max-health` | unbounded | Inclusive maximum maximum-health value. |

### Example

```yaml
type: health_percent
target: TARGET
min: 0
max: 25
min-max-health: 20
```

### Behavior and limits

* Percentage is calculated as current health divided by maximum health times 100.
* This condition does not use `compare` / `value`.

***

## `has_potion`

**Purpose:** Checks whether a living entity has a specific active potion effect.

**Context:** Default `target`: `TARGET`; requires a living entity.

### Fields

| Field    | Default  | Description                                                |
| -------- | -------- | ---------------------------------------------------------- |
| `target` | `TARGET` | Entity selector.                                           |
| `potion` | empty    | Potion-effect namespaced key or supported enum-style name. |

### Example

```yaml
type: has_potion
target: TARGET
potion: minecraft:poison
```

### Behavior and limits

* An invalid or empty effect key does not match.
* Use common `not: true` to require that the effect is absent.

***

## `distance`

**Purpose:** Checks Euclidean distance between two context entities.

**Context:** Default `source`: `SOURCE`; default `target`: `TARGET`; both entities must exist in the same world.

### Fields

| Field             | Default   | Description                     |
| ----------------- | --------- | ------------------------------- |
| `source`          | `SOURCE`  | First entity selector.          |
| `target`          | `TARGET`  | Second entity selector.         |
| `min / max`       | unbounded | Inclusive distance range.       |
| `compare / value` | unset     | Alternative numeric comparison. |

### Example

```yaml
type: distance
source: SOURCE
target: TARGET
min: 4
max: 16
```

### Behavior and limits

* Cross-world entities do not match.

***

## `food_level`

**Purpose:** Checks a player's current food level.

**Context:** Default `target`: `TARGET`; selected entity must be a player.

### Fields

| Field             | Default   | Description                     |
| ----------------- | --------- | ------------------------------- |
| `target`          | `TARGET`  | Entity selector.                |
| `min / max`       | unbounded | Inclusive range.                |
| `compare / value` | unset     | Alternative numeric comparison. |

### Example

```yaml
type: food_level
target: SOURCE
max: 6
```

### Behavior and limits

* Food level is the integer Bukkit value from 0 to 20.

***

## `gliding`

**Purpose:** Checks a living entity's gliding state.

**Context:** Default `target`: `TARGET`; requires a living entity.

### Fields

| Field    | Default  | Description      |
| -------- | -------- | ---------------- |
| `target` | `TARGET` | Entity selector. |
| `value`  | `true`   | Expected state.  |

### Example

```yaml
type: gliding
target: SOURCE
value: true
```

### Behavior and limits

* Non-living entities do not match.

***

## `on_ground`

**Purpose:** Checks an entity's on-ground state.

**Context:** Default `target`: `TARGET`; requires an entity.

### Fields

| Field    | Default  | Description      |
| -------- | -------- | ---------------- |
| `target` | `TARGET` | Entity selector. |
| `value`  | `true`   | Expected state.  |

### Example

```yaml
type: on_ground
target: TARGET
value: true
```

### Behavior and limits

* The value comes from Bukkit's current on-ground flag.

***

## `in_air`

**Purpose:** Checks the inverse of an entity's on-ground state.

**Context:** Default `target`: `TARGET`; requires an entity.

### Fields

| Field    | Default  | Description              |
| -------- | -------- | ------------------------ |
| `target` | `TARGET` | Entity selector.         |
| `value`  | `true`   | Expected airborne state. |

### Example

```yaml
type: in_air
target: TARGET
value: true
```

### Behavior and limits

* The selected entity must exist.

***

## `match_entity`

**Purpose:** Runs the normal Match Entity rule engine against a selected living entity.

**Context:** Default `target`: `TARGET`; selected entity must be living.

### Fields

| Field    | Default  | Description                             |
| -------- | -------- | --------------------------------------- |
| `target` | `TARGET` | Entity selector.                        |
| `match`  | required | Nested MatchEntityFormat configuration. |

### Example

```yaml
type: match_entity
target: TARGET
match:
  entity-types:
    - PLAYER
  entity-health:
    min: 1
```

### Behavior and limits

* A missing `match` section fails.
* The nested rules are the same rules used by the plugin's normal entity-matching system.

***

## `first_attack_against_entity`

**Purpose:** Matches only the first qualifying source-player/target pair for this condition path.

**Context:** Requires player `SOURCE`, living `TARGET`, and a non-cancelled current result.

### Fields

*No type-specific fields.*

### Example

```yaml
type: first_attack_against_entity
```

### Behavior and limits

* State identity includes attacker UUID, power ID, configuration path, and target UUID.
* The first successful evaluation stores state immediately; state is cleared by runtime cleanup.

***
