# Denizen API

{% hint style="warning" %}
需要 ItemsAdder 3.2.4+
{% endhint %}

## 下载最新构建

{% embed url="<https://ci.citizensnpcs.co/job/Denizen/>" %}

## 功能

<pre class="language-yaml"><code class="lang-yaml"><strong># 检查物品是否为自定义物品
</strong><strong>player.item_in_hand.is_ia_item
</strong># 检查物品是否为自定义方块
player.item_in_hand.is_ia_block
# 获取物品命名空间 ID
player.item_in_hand.ia_namespaced_id

# 放置自定义方块。
# 语法 set_custom_block [&#x3C;location>|...] [&#x3C;namespaced_id>]
set_custom_block &#x3C;context.location> ruby_block 
# 检查方块是否为自定义方块
context.location.is_ia_block
# 获取方块命名空间 ID
context.location.ia_namespaced_id
</code></pre>

## 示例

```yaml
my_world_script:
    type: world
    events:
        after player left clicks block:
            - narrate " "
            - if <player.item_in_hand.is_ia_block>:
                - narrate "Left click item is a custom block! <&6><player.item_in_hand.ia_namespaced_id>"
            - else:
                - narrate "Left click item is NOT a custom block! <&7><player.item_in_hand.material>"
            - narrate " "
        after player right clicks block:
            - if <player.is_sneaking>:
                - set_custom_block <context.location> ruby_block 
            - else:
                - narrate " "
                - if <player.item_in_hand.is_ia_item>:
                    - narrate "Right click item is a custom item! <&6><player.item_in_hand.ia_namespaced_id>"
                - else:
                    - narrate "Right click item is NOT a custom item! <&7><player.item_in_hand.material>"

                - if <context.location.is_ia_block>:
                    - narrate "Interacted block is a custom block! <&6><context.location.ia_namespaced_id>"
                - else:
                    - narrate "Interacted block is NOT a custom block!"
                - narrate " "
```


---

# 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://itemsadder.devs.beer/chinese/kai-fa-zhe/denizen-api.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.
