概览
minecraft:storage_item 是一个物品组件:写在自定义物品的 components 对象中。 让物品可以在里面装其他物品,就像收纳袋一样。minecraft:bundle_interaction 等其他组件会使用这个存储空间。
这是实验性功能:只有在开启了对应实验性玩法的世界中才能生效,并且在以后的版本中可能会改变。
字段
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
max_slots | integer | 64 | 最多能存放多少组不同的物品,上限 64。范围:… 到 64 |
allow_nested_storage_items | boolean | true | 为 false 时,不能把其他存储物品(比如收纳袋)放进去。 |
banned_items | Item Descriptor[] | 无 | 永远不能放进去的物品。 |
allowed_items | Item Descriptor[] | 无 | 设置后,只有这些物品能放进去。留空表示允许所有物品。 |
示例
写在 BP/items/<name>.json 的 components 对象中(值为默认值或占位值):
BP/items/<name>.json
{
"minecraft:storage_item": {
"max_slots": 64,
"allow_nested_storage_items": true,
"banned_items": [],
"allowed_items": []
}
}