How to explode TNT in Minecraft pi

Step-1: Install Minecraft pi.

sudo apt-get update
sudo apt-get install Minecraft-pi

Step-3:Open Python.

Then type in this command

import mcpi.minecraft
import time

mc = mcpi.minecraft.Minecraft.create();

while True:
hits =
for hit in hits:
block = mc.getBlockWithData(hit.pos.x, hit.pos.y, hit.pos.z); = ( + 1) & 0xf;
mc.setBlock(hit.pos.x, hit.pos.y, hit.pos.z,,
mc.postToChat("Block data is now " + str(

Step-4: open Minecraft pi.

Type minecraft-pi in the terminal


Save and run the python command

Step-6: igniting the TNT

Right click with the sword and left click to ignite the TNT



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Azaan Hasan

Azaan Hasan


Student studying in class-8 , tech lover, cuber and programmer..