Minecraft: PI – Place Blocks Under the Player

This script will place blocks under the player while walking around.

# Import the minecraft library
import mcpi.minecraft import Minecraft
import time

# connect to the minecraft client
mc = Minecraft.create()

# cobblestone
blockType = 4

# place blocks under the player
while True:
  pos = mc.player.getTilePos()
  height = mc.getHeight(pos.x, pos.y)
  mc.setBlock(pos.x, pos.y - 1, pos.z, blockType)
  time.sleep(0)