> 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/format/match-entity-format/logic.md).

# Logical Rules

Every rule on this page is a key inside a [MatchEntityFormat](/format/match-entity-format.md) section.

***

## `any`

**Purpose:** Accepts an entity when at least one nested alternative matches.

**Context:** Nested sections use the same MatchEntityFormat rules.

### Fields

| Field | Default | Description                               |
| ----- | ------- | ----------------------------------------- |
| `any` | unset   | A direct rule section or numbered groups. |

### Direct-rule layout

```yaml
match-entity:
  any:
    entity-types:
      - ZOMBIE
    entity-contains-name:
      - Boss
```

When `any` does not contain a key named `1`, every directly nested rule is tested independently. The example matches a zombie **or** an entity whose name contains `Boss`.

### Numbered-group layout

```yaml
match-entity:
  any:
    1:
      entity-types:
        - SKELETON
      ranged: true
    2:
      mythicmobs:
        - SkeletonKing
```

When `any` contains a key named `1`, each child is a complete MatchEntityFormat group:

* rules inside one group use AND;
* groups use OR.

### Behavior and limits

* A missing or empty `any` section returns true when evaluated.
* Numbered-group mode is detected specifically by key `1`; begin numbering at `1`.
* The direct layout treats rules as alternatives, not as one AND group.
* Use numbered groups when one alternative needs multiple simultaneous requirements.
* Optional integration rules that are not registered are skipped inside `any`, just as they are at the top level.

***

## `not`

**Purpose:** Rejects an entity when any nested rule matches.

**Context:** Nested keys use the same MatchEntityFormat rules.

### Fields

| Field | Default | Description                             |
| ----- | ------- | --------------------------------------- |
| `not` | unset   | Rules whose matches should be rejected. |

### Example

```yaml
match-entity:
  monster: true
  not:
    entity-types:
      - CREEPER
    entity-contains-name:
      - Protected
```

### Behavior and limits

* Nested rules are separate rejection alternatives.
* The example rejects creepers **or** entities whose name contains `Protected`.
* `not` does not combine all nested rules with AND and then invert the combined result.
* An empty `not` section passes because no nested rule rejects the entity.
* For complex accepted alternatives, use numbered `any` groups outside `not` and structure the surrounding matcher explicitly.
