物品组件

2025-11-25 08:43:13 6349

此特性为基岩版独有。

JSON格式。类似于NBT标签,但仅支持minecraft:can_place_on、minecraft:can_destroy、minecraft:item_lock和minecraft:keep_on_death。

目录

1 组件类型

1.1 can_place_on

1.2 can_destroy

1.3 item_lock

1.3.1 lock_in_inventory

1.3.2 lock_in_slot

1.4 keep_on_death

2 示例

3 参考

组件类型[]

can_place_on[]

控制此物品/方块(在冒险模式下)可以使用/放置在其上的方块类型。

can_destroy[]

控制此物品/方块(在冒险模式下)可以破坏的方块类型。此效果不会改变原本的破坏速度和破坏后掉落物。

item_lock[]

将该物品锁定在玩家的物品栏。用mode参数来指定锁定的类型。必须是lock_in_inventory或lock_in_slot。[1]

lock_in_inventory[]

阻止该物品被从玩家的物品栏移除、丢弃或用于合成。

lock_in_slot[]

阻止该物品被从玩家物品栏的该槽位移动、移除、丢弃或用于合成。

keep_on_death[]

使该物品在玩家死亡时不会掉落。

示例[]

/give @p iron_shovel 1 0 {"minecraft:can_destroy":{"blocks":["grass"]},"minecraft:item_lock":{"mode":"lock_in_slot"}}

/give @p netherite_pickaxe 1 0 {"minecraft:keep_on_death":{}}

/replaceitem entity @s slot.hotbar 0 concrete 1 0 {"minecraft:can_place_on":{"blocks":["grass"]}}

/replaceitem entity @s slot.weapon.mainhand 0 spawn_egg 64 110 {"minecraft:item_lock":{"mode":"lock_in_inventory"}}

/replaceitem entity @s slot.hotbar 0 spawn_egg 5 51 {"minecraft:item_lock":{"mode":"lock_in_inventory"},"minecraft:can_place_on":{"blocks":["grass"]}}

参考[]

↑ Minecraft - 1.16.100 (Bedrock) — Minecraft Feedback,2020年11月16日。

语言

English

日本語