Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 52 lines (40 sloc) 1.21 KB
# These two lines are because of the folder the demos are located in, and aren't normally necessary
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
from minecraftstuff import MinecraftShape
import mcpi.minecraft as minecraft
import mcpi.block as block
import time
# Connect to minecraft server 127.0.0.1 as player 'steve'
mc = minecraft.Minecraft.create(address="127.0.0.1", name="steve")
#test shape
pos = mc.player.getTilePos()
pos.y += 40
myShape = MinecraftShape(mc, pos)
try:
print("draw shape")
myShape.setBlocks(-5, 0, -5, 3, 0, 3, block.WOOL.id, 5)
print("draw shape done")
time.sleep(5)
roll = 0
pitch = 0
yaw = 0
#angles = [15,30,45,60,75,90]
angles = [45, 90]
print("roll shape")
for roll in angles:
myShape.rotate(yaw, pitch, roll)
print("roll shape {} done".format(roll))
time.sleep(1)
for pitch in angles:
myShape.rotate(yaw, pitch, roll)
time.sleep(1)
for yaw in angles:
myShape.rotate(yaw, pitch, roll)
time.sleep(1)
for count in range(0,5):
myShape.moveBy(1,0,0)
time.sleep(0.5)
time.sleep(5)
finally:
myShape.clear()