Item components

From Minecraft Wiki
Jump to: navigation, search
Information icon.svg
This feature is exclusive to Bedrock Edition.

JSON formatted. Like data tags but supports only minecraft:can_place_on, minecraft:can_destroy, minecraft:lock_in_inventory[upcoming: BE 1.16.100], minecraft:lock_in_slot[upcoming: BE 1.16.100] and minecraft:keep_on_death[upcoming: BE 1.16.100] functions.

Examples[edit]

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

/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:lock_in_inventory":{}}

Component Types[edit]

can_place_on[edit]

Controls what block types this block may be placed on.

can_destroy[edit]

Controls what block types this item can destroy.

lock_in_inventory[upcoming: BE 1.16.100][edit]

Prevents the item from being removed from the player's inventory, dropped, or crafted with.

lock_in_slot[upcoming: BE 1.16.100][edit]

Prevents the item from being moved or removed from its slot in the player's inventory, dropped, or crafted with.

keep_on_death[upcoming: BE 1.16.100][edit]

Prevents the item from being dropped when the player dies.

Issues[edit]

  • Can only be applied to blocks.
  • Can not differentiate blocks by Data ID.
  • Can only whitelist blocks - not possible to blacklist instead. However you can use this to make something not able to break anything: {"minecraft:can_destroy":{"blocks":["air"]}}
  • Can only be used with /give and /replaceitem.