Skip to content

Instantly share code, notes, and snippets.

@benjjo
Created November 20, 2016 04:04
Show Gist options
  • Save benjjo/5b4042367c81e392a56d409ba82925e1 to your computer and use it in GitHub Desktop.
Save benjjo/5b4042367c81e392a56d409ba82925e1 to your computer and use it in GitHub Desktop.
Minecraft Pi compass. Designed to indicate NORTH with a red block and SOUTH with a black block.
#!/usr/bin/python3.4
#--------------------------------------------------------------------------
# Name: A simple compass for Minecraft Pi
# Purpose: Designed to indicate NORTH with a red block and SOUTH with
# a black block.
# Author: benjo charlie
# Created: 2016
#--------------------------------------------------------------------------
# Import libraries and set up the globals
import mcpi.minecraft as minecraft
mc = minecraft.Minecraft.create()
x, y, z = mc.player.getPos()
# Use an Obsidian black block for South.
mc.setBlock(x, y, z-1, 49)
#Use a Glowing Obsidian red block for North.
mc.setBlock(x, y, z-2, 246)
mc.postToChat("Try not. Do, or do not. There is no try.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment