> 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). Agents can also search and read this documentation through its [MCP server](https://enchantedmobs.superiormc.cn/~gitbook/mcp).

# 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](https://enchantedmobs.superiormc.cn/configs/power-conditions.md) page.

## Registry keys on this page

* `headshot`
* `height`
* `sneaking`
* `not_sneaking`
* `min_attack_cooldown`
* `blocking`
* `perfect_guard`
* `swimming`
* `flying`
* `climbing`
* `riding`
* `game_mode`
* `health`
* `health_percent`
* `has_potion`
* `distance`
* `bounding_box_distance`
* `food_level`
* `gliding`
* `on_ground`
* `in_air`
* `falling`
* `fall_distance`
* `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.

***

## `bounding_box_distance`

Checks the shortest distance from one selected entity position to another entity's bounding box. `source` defaults to `SOURCE`, `target` to `TARGET`, and `source-eye` to `false`. It supports the shared numeric `min`, `max`, `compare`, and `value` fields.

```yaml
type: bounding_box_distance
source: SOURCE
target: TARGET
source-eye: true
min: 3
max: 6.5
```

Points inside the target hitbox have distance `0`; 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.

***

## `falling`

Checks whether a selected entity is airborne and moving downward. `target` defaults to `TARGET`, `maximum-y` defaults to `0`, and `value` defaults to `true`.

```yaml
type: falling
target: SOURCE
maximum-y: 0
value: true
```

***

## `fall_distance`

Compares a selected entity's accumulated Bukkit fall distance. It supports `min`, `max`, `compare`, and `value`.

```yaml
type: fall_distance
target: SOURCE
min: 3
```

***

## `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.

***

## `min_attack_cooldown`

Checks a selected player's current attack cooldown strength. `target` defaults to `TARGET`; `value` is the inclusive minimum and defaults to `0`.

```yaml
type: min_attack_cooldown
target: SOURCE
value: 0.9
```

***

## `blocking`

Checks whether the selected living entity is actively blocking with a shield. `target` defaults to `TARGET` and boolean `value` defaults to `true`. Players use Bukkit's active blocking state; other living entities match while raising a hand with a shield equipped.

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

***

## `perfect_guard`

Matches a target player who is blocking within a short window after raising a shield. `target` defaults to `TARGET`, `window-millis` defaults to `120`, and `consume` defaults to `true`.

```yaml
type: perfect_guard
target: TARGET
window-millis: 180
consume: true
```

This is useful on a mob's attack trigger when its target is a player. With `consume: true`, one shield raise can match only once.

***

## `swimming`

Checks a selected player's swimming state. `target` defaults to `TARGET` and boolean `value` defaults to `true`.

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

***

## `flying`

Checks a selected player's flying state. `target` defaults to `TARGET` and boolean `value` defaults to `true`.

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

***

## `climbing`

Checks a selected living entity's climbing state. `target` defaults to `TARGET` and boolean `value` defaults to `true`.

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

***

## `riding`

Checks whether the selected entity is riding another entity. `target` defaults to `TARGET` and boolean `value` defaults to `true`.

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

***

## `game_mode`

Checks the selected player's game mode. `target` defaults to `TARGET`; use `mode` for one mode or `modes` for a list.

```yaml
type: game_mode
target: TARGET
modes:
  - SURVIVAL
  - ADVENTURE
```

***
