Minecraft – Primed tnt command help

minecraft-commandsminecraft-java-edition

I would like to summon primed tnt at a certain block in Minecraft or place a block above/next to an already placed block.

I have a gold block and I want to turn it into primed tnt, but don't know the coordinates. Is there a command that turns all of one type of block into primed tnt?

Best Answer

The command to summon primed tnt in 1.12.2 is:

/summon tnt <x> <y> <z>

You could also add data tag Fuse to increase the fused time:

/summon tnt <x> <y> <z> {Fuse:80}

Fuse specifies the number of ticks of delay before the explosion. In this case, 80 ticks would be about 4 seconds which is the default fuse time for tnt after striking it with flint and steel.


Edit: Response to the edited question. To my knowledge, there is no way to detect all gold blocks and replace them with tnt. @Fabian gave this answer to a similar question. It will only replace blocks around the executor and it will not be primed tnt as the replace option of the fill command does not have data tag argument.

You could add the execute command in a RepeatUnconditionalAlways Active command block to cause this to happen constantly. Either around yourself or all players if multiplayer. This would not be efficient and if executed for all players, would not allow players to place gold blocks. They would have a system to convert gold blocks into tnt. If you want to do this the command is:

execute @a ~ ~ ~ fill ~-15 ~-15 ~-15 ~15 ~15 ~15 tnt 0 replace gold_block