TNT Trail!

Today on Minecraft Pi Edition I programmed a TNT trail. You walk around after the code has been ran, and TNT appears! Ignite some! Please note that not all the TNT is ignitable but the unignitable TNT still blows up when ignitable TNT blows up.

Copy and paste the code into Geany (or your preferred Python environment) and run it. Make sure you are on a world on Minecraft and hit the TNT that appears each step. Press CTRL +C in your Python environment to stop the TNT trail.

The code is here:

from mcpi.minecraft import Minecraft
from time import sleep

mc = Minecraft.create()
x, y, z = mc.player.getPos() # player position (x, y, z)
this_block = mc.getBlock(x, y, z) # block ID
print(this_block)
tnt = 46

while True:
x, y, z = mc.player.getPos() # player position (x, y, z)
block_beneath = mc.getBlock(x, y-1, z) # block ID

if block_beneath == tnt:
mc.setBlock(x, y, z, tnt, 1)
sleep(0.1)
else:
mc.setBlock(x, y-1, z, tnt)
Enjoy!

Epic Chas Gamer 🙂

 

 

 

 

 

One thought on “TNT Trail!

  1. Woo, hoo! This blog is so epic and amazing! I blew up my world and when I fell into the void I saw hardly any of the world left. Perfect for multiplayer!

Comments are closed.