How do you get blocks to hold NBT data between getting placed and broken? [duplicate]

How do you get blocks to hold NBT data between getting placed and broken? [duplicate] - Man in White Dress Shirt Wearing Black Sunglasses

How do you get a block to hold NBT data even after being placed and broken? I'm trying to make an adventure map, but a lever with the following code:

{CanPlaceOn:["minecraft:stone"]}

can only be placed once before losing its data and being rendered unable to be placed again. Breaking the lever will give you a generic lever with no modifications. How do I get around this? How can I get a lever with the above NBT tag when it is broken?



Best Answer

name the lever and then do a test for command so you can have multiple levers




Pictures about "How do you get blocks to hold NBT data between getting placed and broken? [duplicate]"

How do you get blocks to hold NBT data between getting placed and broken? [duplicate] - Top View of a Family Praying Before Christmas Dinner
How do you get blocks to hold NBT data between getting placed and broken? [duplicate] - Asian man helping friend to get up from ground
How do you get blocks to hold NBT data between getting placed and broken? [duplicate] - Student Getting His Test Paper



How do you make a block that can only be placed on certain blocks?

NBT tags are used in game commands such as: /summon, /data, /give, /fill, /setblock. The NBT tag is always surrounded in {} such as {NoAI:1}. If there is more than one NBT tag used in a command, the NBT tags are separated by a comma such as {NoAI:1, IsBaby:1}. Each entity (or mob) has its own unique set of NBT tags.



Minecraft: How to get Pre-filled Chests, Dispensers, etc. with (+NBT) Data - Tutorial




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Thirdman, Nicole Michalou, Allan Mas, RODNAE Productions