Placing structure on a placed block
-
I'm playing around with command blocks, and would like to have a structure appear when a block (specifically a copper block) is placed. I want the structure to be placed relative to the block, and the block can be placed in about 20 different positions in total. Ideally, the structure should also be removed once the block is destroyed.
The code itself only has to run once every 2mins or something like that, so it doesn't have to be terribly well optimised.
Is there any easy-ish way for me to make this? As of now I have painstakingly placed
execute run setblock
s for all the positons, but there is definitely a better solution.I guess the question can also be rephrased as "How to run a command for all blocks of a type in an area" (and then use
clone
).Any help is appreciated, although I am still very new to commands (I only just started with nbt data) so please explain if it's a strange concept.
-
the easiest way would actually be to use an entity of some sort to summon th blocks around it and then killing the entity using /kill @e[type=,name=] to kill it and use the execute command to place blocks around it. eg: execute as @e[type=pig,name=summoner] at @s run setblock ~ ~ ~1 concrete, and the next command would be /kill @e[type=pig,name=summoner] and make sure to have that first command in a repeat command block.