How can I shorten the time of a TNT explosion?

Can I actually shorten the time of the explosion? When a creeper comes close to the player, the creeper needs time to charge and then explode, the same goes with TNT - it needs time to charge and then explode. So, can I actually shorten the time of explosion so that when people light the TNT block/creeper comes close to a player, they will explode immediately with commands?


Solution 1:

Yes

You can use the following two commands in command blocks to cause all creepers and TNT blocks to explode immediately:

/entitydata @e[type=PrimedTnt] {Fuse:0}
/entitydata @e[type=Creeper] {Fuse:1}

Note that the value of the Fuse tag is set to 1 for the Creeper. This is because if it is set to 0, then the Creeper will explode immediately whether or not a player is near. This is due to Minecraft reading the Fuse tag as how long is left until the explosion, i.e. 0 - 0 ticks left, let's go boom already!

The Fuse tag is measured in Ticks, 20 ticks = 1 second, 30 ticks = 1.5 seconds, etc. The default values are as follows: 80 ticks (4 seconds) for the TNT, and 30 ticks (1.5 seconds) for the Creeper.

You can use the above commands as is in always active repeating command blocks, or a command block on a clock to have all TNT explode immediately upon ignition, and all Creepers explode immediately upon a Player entering it's attack range. You can also modify the commands to only affect TNT and Creepers in a certain area, under certain conditions, or lengthen the fuse to not be immediate. With Minecraft the possibilities are endless.

Sources:

Testing in Minecraft

http://minecraft.gamepedia.com/TNT

http://minecraft.gamepedia.com/Creeper