Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

aodFinal.py

By: a guest on Mar 18th, 2013  |  syntax: None  |  size: 1.64 KB  |  views: 158  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #Based on code from www.stuffaboutcode.com
  2. #Raspberry Pi, Minecraft API - the basics
  3.  
  4.  
  5. #import the minecraft.py module from the minecraft directory
  6. import minecraft.minecraft as minecraft
  7. #import minecraft block module
  8. import minecraft.block as block
  9. #import time, so delays can be used
  10. import time
  11.  
  12. if __name__ == "__main__":
  13.  
  14.  
  15. # - minecraft needs to be running and in a game
  16.     mc = minecraft.Minecraft.create()
  17.  
  18. #Post a message to the minecraft chat window
  19.     mc.postToChat("Aura Of Destruction activated")
  20.  
  21.     try:
  22.         while True:
  23.             playerPos = mc.player.getPos()
  24.             playerPos = minecraft.Vec3(int(playerPos.x), int(playerPos.y), int(playerPos.z))
  25.             #to resolve issues with negative positions
  26.             if playerPos.z < 0: playerPos.z = playerPos.z - 1
  27.             if playerPos.x < 0: playerPos.x = playerPos.x - 1
  28.             if playerPos.y < 0: playerPos.y = playerPos.y - 1
  29.             mc.setBlock(playerPos.x,playerPos.y-1,playerPos.z,block.AIR)
  30.             mc.setBlock(playerPos.x,playerPos.y,playerPos.z+1,block.AIR)
  31.             mc.setBlock(playerPos.x,playerPos.y,playerPos.z-1,block.AIR)
  32.             mc.setBlock(playerPos.x,playerPos.y+1,playerPos.z+1,block.AIR)
  33.             mc.setBlock(playerPos.x,playerPos.y+1,playerPos.z-1,block.AIR)
  34.             mc.setBlock(playerPos.x+1,playerPos.y,playerPos.z,block.AIR)
  35.             mc.setBlock(playerPos.x-1,playerPos.y,playerPos.z,block.AIR)
  36.             mc.setBlock(playerPos.x+1,playerPos.y+1,playerPos.z,block.AIR)
  37.             mc.setBlock(playerPos.x-1,playerPos.y+1,playerPos.z,block.AIR)
  38.     except KeyboardInterrupt:
  39.             time.sleep(1)