> 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/enchantedmobs-zhong-wen-wen-dang/features/pi-pei-shi-ti-ge-shi-match-entity-format.md).

# 匹配实体格式（Match Entity Format）

`Match Entity Format` 会读取同一节点的全部规则，默认 **AND** 关系。

```yaml
match-entity:
  entity-types:
    - zombie
  ranged: false
```

***

### 字段总览

#### entity-types

作用：按实体类型匹配（如 zombie / skeleton）。

```yaml
entity-types:
  - zombie
  - husk
```

***

#### entity-tag

作用：按原版 Entity Tag 匹配。

```yaml
entity-tag:
  - minecraft:undead
  - minecraft:raiders
```

***

#### entity-contains-name

作用：实体名称包含指定文本（忽略颜色与格式）。

```yaml
entity-contains-name:
  - Boss
  - 精英
```

***

#### entity-health

作用：实体当前血量下限判断（`>=`）。

```yaml
entity-health: 10
```

***

#### ranged - 仅 Paper

作用：是否要求“远程单位”。

* `true`：必须是远程
* `false`：必须不是远程

```yaml
ranged: true
```

***

#### equip

作用：按实体装备槽位进行匹配（每个槽位内部复用 Match Item 规则）。

可用槽位：

* `main-hand`
* `off-hand`
* `helmet`
* `chestplate`
* `leggings`
* `boots`

```yaml
equip:
  main-hand:
    material:
      - bow
  helmet:
    has-enchants:
      - protection
```

> 注意：当前实现是“只要任意被配置的槽位匹配成功即返回 true”。

***

#### entity-pdc

作用：按 PersistentDataContainer 键值匹配（支持字符串、数值、布尔）。

**字符串规则**

* 支持精确匹配
* 支持包含匹配
* 支持 `*` 通配符

```yaml
entity-pdc:
  myplugin:role: boss*
```

**数值规则**

支持：`5~10`、`>=5`、`<=10`、`>5`、`<10`、`=8` 或 `8`

```yaml
entity-pdc:
  myplugin:level: ">=20"
  myplugin:phase: "2~4"
```

**布尔规则**

```yaml
entity-pdc:
  myplugin:awakened: true
```

***

#### mythicmobs（需 MythicMobs）

作用：匹配 MythicMobs 内部 mob 名称。

```yaml
mythicmobs:
  - FireDemon
  - IceBoss
```

***

#### levelled-mobs（需 LevelledMobs）

作用：匹配 LevelledMobs 等级。

支持：

* 精确值：`10`
* 区间：`5~20`
* 比较：`>=15` / `<=30`

```yaml
levelled-mobs: ">=25"
```

***

#### any

作用：OR 逻辑组合（命中任意一组即可）。

**方式 1：分组 OR（推荐）**

```yaml
any:
  1:
    entity-types:
      - zombie
  2:
    entity-tag:
      - minecraft:raiders
```

**方式 2：同层 OR**

```yaml
any:
  ranged: true
  entity-health: 30
```

***

#### not

作用：取反（`not` 内任意规则命中则整体失败）。

```yaml
not:
  entity-types:
    - villager
```

***

#### none

作用：始终不匹配（可用于占位或临时关闭规则）。

```yaml
none: true
```


---

# 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://enchantedmobs.superiormc.cn/enchantedmobs-zhong-wen-wen-dang/features/pi-pei-shi-ti-ge-shi-match-entity-format.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.
