forked from mikemccllstr/mikemccllstr-python-minecraft
-
Notifications
You must be signed in to change notification settings - Fork 2
/
clear.py
executable file
·33 lines (26 loc) · 925 Bytes
/
clear.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python
import mcpi.minecraft as minecraft
import mcpi.block as block
import sys
""" clearZone clears an area and sets a stone floor
takes two x,z pairs clears everything above 0y and then sets
a stone floor at -1y
@author: goldfish
Modified by Jessica Zehavi for CoderDojo Twin Cities
http://www.coderdojotc.org
"""
def clearZone( size ):
mc.player.setPos(0,0,0)
[x,y,z] = [0,0,0];
mc.setBlocks( x - size, 0, z - size, x + size, size, z + size, block.AIR )
mc.setBlocks( x - size , -1, z - size, x + size, -1, z + size, block.STONE )
if __name__ == "__main__":
mc = minecraft.Minecraft.create( )
try:
size = sys.argv[1]
mc.postToChat( "Clearing things up a bit..." )
print "Clearing a", size, "x", size, "area around your position."
clearZone( int(size) )
except:
print "Specify the size of zone you would like to clear."
print "Syntax:", sys.argv[0], "<size in blocks>"