Lesson 13: Minecarts

Automatic minecart tracks!


In this video we must get to the other side of the tunnel using code to program minecraft rails to appear down the tunnel ride our minecart!


#Auto Track
import mcpi.minecraft as minecraft
import mcpi.block as block
import time
mc = minecraft.Minecraft.create()
mc.postToChat("Auto Track: Active")
time.sleep(2)

playerPos = mc.player.getPos()
yValue = playerPos.y

while(yValue == playerPos.y):
	playerPos = mc.player.getPos()
	mc.postToChat("Track")
	
	mc.setBlocks(playerPos.x,playerPos.y+1,playerPos.z, 
	playerPos.x+2,playerPos.y+1,playerPos.z,27,1)
	
	mc.setBlocks(playerPos.x,playerPos.y+1,playerPos.z+1, 
	playerPos.x+2,playerPos.y+1,playerPos.z+1,76)
	
	standBlock = mc.getBlock(playerPos.x,playerPos.y,playerPos.z)
	if standBlock == 57:
		break