7

How do you add NBT tags to commands? I’ve tried commands that normally work in Java Edition like:

give @s minecraft:planks 30 1 {display:{Lore:["Wooden planks"]}}
give @s potion 1 0 {Potion:"minecraft:night_vision"}
give @s diamond_sword 1 0 {ench:[{id:16,lvl:5}]}
give @s minecraft:stone 1 0 {CanPlaceOn:["minecraft:grass","minecraft:dirt"]}
summon creeper ~ ~ ~ {powered:1,CustomName:"Powered Creeper"}
8

Unfortunately, this is not possible in PE or BE (Bedrock Edition) except for the "can_place_on" or "can_destroy" tag:

/give @s stone 1 0 {"can_place_on":{"blocks":["grass","dirt"]}}

This gives yourself 1 stone that can be placed on grass and dirt.

/give @s iron_shovel 1 0 {"can_destroy":{"blocks":["grass","dirt"]}}

This gives yourself 1 iron shovel that can destroy grass and dirt.

  • 6
    Hm, nice self-answered question. I usually close these questions as duplicate of some random alike question of that category, now I can use this. Thanks! – Fabian Röling Jun 22 '18 at 22:10
4

This is only possible for the potion, the stone, and the {powered:1} section of the creeper, although the syntax is slightly different. Based on other answers here, we know that it is impossible to add NBT tags in Bedrock Edition. However, there are loopholes for the items above.

For the potion, we'll use the data integer of 5, meaning Night Vision for 3 minutes. Link here: https://www.digminecraft.com/generators/give_potion_pe.php

/give @p potion 1 5

For the stone, we can use JSON components for the abilities to place on certain items. This only works in adventure mode.

/give @s minecraft:stone 1 0 {"minecraft:can_place_on":{"blocks":["minecraft:grass","minecraft:dirt"]}}

Finally, for the powered creeper, we can utilize spawn events to make this possible in Bedrock Edition.

/summon creeper ~ ~ ~ minecraft:become_charged

I hope this helps!

-2

At the current time, Mojang is supposedly working on a "Component" system which is supposed to let players on Bedrock and Pocket Editions use Data/NBT tags, such as the command /summon creeper ~~~ {powered:1} or /give @s diamond_sword 1 0 {Unbreakable:1}. I do not know when it will be finished, but you will have to wait at least another 2-3 months, I'm guessing. I will get back to you if I find out.

Not the answer you're looking for? Browse other questions tagged or ask your own question.