# 掉落物

**ItemsAdder** 内也内置了一套管理掉落物的系统，主要包括：

* 破坏方块后获得的掉落物
* 击杀生物后获得的掉落物
* 钓鱼获得的掉落物

### 破坏方块后获得的掉落物

在任意物品配置文件中添加如下内容：

```
loots:
  blocks:
    ruby_ore:
      type: itemsadder:ruby_ore
      items:
        ruby:
          item: itemsadder:ruby
          min_amount: 1
          max_amount: 2
          chance: 50
    nether_quartz_ore:
      type: NETHER_QUARTZ_ORE
      drop_only_first: true
      items:
        crystal:
          item: itemsadder:crystal
          min_amount: 1
          max_amount: 2
          chance: 10
        knowledge_fragment:
          item: itemsadder:knowledge_fragment
          min_amount: 1
          max_amount: 2
          chance: 15
```

其中，`blocks` 代表下面的配置是破坏方块后获得的掉落物，在该示例中，包含了 **2** 个破坏方块后获得的掉落物设置，一个id为 `ruby_ore`，另外一个id为 `nether_quartz_ore`：

* type：该设置作用的方块id，可以是原版方块id，也可以是 **IA** 的方块id。
* items：破坏 `type` 中所设置的方块后掉落的物品，可用设置无数多个，其下包括：`item` 为掉落的物品id，`min_amount`、`max_amount` 分布为掉落的最小数量和最多数量，`chance` 为掉落的几率。另有可选选项：`ignore_fortune` 为是否无视时运附魔的增益效果。
* drop\_only\_first：是否只从 `items` 中最多选择一个掉落物掉落。
* biomes：该配置生效的生物群系，格式参见前面的 **世界生成** 一节即可。
* nbt：见下文介绍。

### 其他两种掉落物

由于其他两种掉落物的配置选项与上文近乎一致，本教程不再赘述，只给出示例：

钓鱼获得的掉落物的示例，其中 `fishing` 即代表下面的配置为钓鱼获得的掉落物：

```
loots:
  fishing:
    loot_blue_parrotfish:
      biomes:
        - WARM_OCEAN
      items:
        item_1:
          item: itemsadder:blue_parrotfish
          min_amount: 1
          max_amount: 1
          chance: 5
    loot_green_sunfish:
      items:
        item_1:
          item: itemsadder:green_sunfish
          min_amount: 1
          max_amount: 1
          chance: 5
    loot_goldfish:
      items:
        item_1:
          item: itemsadder:goldfish
          min_amount: 1
          max_amount: 1
          chance: 5
```

击杀生物获得的掉落物的示例，其中 `mobs` 即代表下面的配置为击杀生物获得的掉落物：

```
loots:
  mobs:
    villager:
      type: VILLAGER
      nbt:
        profession:
          path: VillagerData.profession
          value: minecraft:farmer
          type: string
      items:
        item_1:
          item: itemsadder:straw_hat
          min_amount: 1
          max_amount: 1
          chance: 100
    ender_dragon:
      type: ENDER_DRAGON
      items:
        item_1:
          item: itemsadder:ender_dragon_wings
          min_amount: 1
          max_amount: 1
          chance: 100
    soul:
      type: HUSK
      metadata:
        ItemsAdderEntity:
          name: "ItemsAdderEntity"
          value: "custom:ninja_skeleton"
          type: "string"
      items:
        ruby:
          item: ruby
          min_amount: 1
          max_amount: 1
          chance: 100
```

### NBT

你可以设置只有带有某个 **NBT** 的方块或者生物才能在破坏或者击杀后获得你所设置的掉落物，关于生物的示例上文已经给出，下文给出方块的示例：

```
loots:
  blocks:
    change_me:
      enabled: true
      type: SPAWNER
      nbt:
        spawner_type:
          path: SpawnData.entity.id
          value: minecraft:zombie
          type: string
      items:
        change_me:
          item: ACACIA_BOAT
          min_amount: 1
          max_amount: 1
          chance: 100
          ignore_fortune: false
```


---

# Agent Instructions: 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://docs.superiormc.cn/itemsadder-doc/fang-kuai/diao-luo-wu.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.
