Lesson 3: Moving on up

Build a staircase with gold blocks!


In this video we learn to build a staircase out of gold blocks. We will learn about modifying coordinates (x,y,z) with our python code.


#Block Stairs
import mcpi.minecraft as minecraft
import mcpi.block as block
mc = minecraft.Minecraft.create()
playerPos = mc.player.getPos()
mc.setBlock(playerPos.x,playerPos.y, playerPos.z-1, block.GOLD_BLOCK)
mc.setBlock(playerPos.x,playerPos.y+1, playerPos.z-2, block.GOLD_BLOCK)
mc.setBlock(playerPos.x,playerPos.y+2, playerPos.z-3, block.GOLD_BLOCK)
mc.setBlock(playerPos.x,playerPos.y+3, playerPos.z-4, block.GOLD_BLOCK)