Lesson 18: Swords and Sorcery

The Lost Python Sword


In our last video we will turn diamond blocks into redstone blocks and reveal the hidden chest containing the Lost Python Sword to defeat the Python King!


import mcpi.minecraft as minecraft
import mcpi.block as block
import time

mc = minecraft.Minecraft.create()

counter = 1

while(True):

	time.sleep(.2)

	hits = mc.events.pollBlockHits()
	
	for hit in hits:
		x = hit.pos.x
		y = hit.pos.y
		z = hit.pos.z
	
		blockType = mc.getBlock(x,y,z)
		if blockType == 57:
			mc.setBlock(x,y,z,152)
			mc.postToChat("Block replaced")