예제 #1
0
    def __init__(self, mc, pos, cleararea = True, makevisible = True):

        self.pos = pos
        self.mc = mc

        #init the MinecraftShape
        MinecraftShape.__init__(self, self.mc, self.pos, visible = False)

        #base
        self.setBlocks(-4, 0, -3, 4, 0, 3, 1, tag = "launch")
        self.setBlocks(3, 0, -4, -3, 0, -4, 1, tag = "launch")
        self.setBlocks(-3, 0, 4, 3, 0, 4, 1, tag = "launch")

        #steel tower
        self.setBlocks(4, 1, 2, 4, 10, 2, 42)
        self.setBlocks(4, 10, 2, 4, 10, -2, 42)
        self.setBlocks(4, 1, -2, 4, 10, -2, 42)

        #glass lift and tunnel
        self.setBlocks(4, 9, 0, 4, 1, 0, 20)
        self.setBlocks(3, 10, 0, 2, 10, 0, 20)

        if cleararea:
            self.clearArea()

        #make the model visible
        if makevisible:
            self.draw()
예제 #2
0
    def __init__(self, mc, pos, cleararea=True, makevisible=True):

        self.pos = pos
        self.mc = mc

        #init the MinecraftShape
        MinecraftShape.__init__(self, self.mc, self.pos, visible=False)

        #base
        self.setBlocks(-4, 0, -3, 4, 0, 3, 1, tag="launch")
        self.setBlocks(3, 0, -4, -3, 0, -4, 1, tag="launch")
        self.setBlocks(-3, 0, 4, 3, 0, 4, 1, tag="launch")

        #steel tower
        self.setBlocks(4, 1, 2, 4, 10, 2, 42)
        self.setBlocks(4, 10, 2, 4, 10, -2, 42)
        self.setBlocks(4, 1, -2, 4, 10, -2, 42)

        #glass lift and tunnel
        self.setBlocks(4, 9, 0, 4, 1, 0, 20)
        self.setBlocks(3, 10, 0, 2, 10, 0, 20)

        if cleararea:
            self.clearArea()

        #make the model visible
        if makevisible:
            self.draw()
예제 #3
0
    def __init__(self, mc, pos, cleararea = True, makevisible = True):

        self.pos = pos
        self.mc = mc

        #init the MinecraftShape
        MinecraftShape.__init__(self, self.mc, self.pos, visible = False)

        #create the AstroPi using setBlock(s) commands
        
        #boards
        self.setBlocks(-6, -3, -9, 7, -3, 11, 35, 13, tag = "rpi_board")
        self.setBlocks(-6, 0, -9, 7, 0, 6, 35, 13, tag = "astropi_board")
        #pillars
        self.setBlocks(-6, -2, -9, -6, -1, -9, 42)
        self.setBlocks(7, -2, -9, 7, -1, -9, 42)
        self.setBlocks(-6, -2, 6, -6, -1, 6, 42)
        self.setBlocks(7, -2, 6, 7, -1, 6, 42)
        #gpio headers
        self.setBlocks(7, 1, -8, 7, 1, 5, 35, 15, tag = "astropi_gpio")
        self.setBlocks(7, -2, -8, 7, -1, 5, 35, 15, tag = "rpi_gpio")
        #usb and ethernet port
        self.setBlocks(4, -2, 8, 6, 0, 11, 42, tag = "usb")
        self.setBlocks(0, -2, 8, 2, 0, 11, 42, tag = "usb" )
        self.setBlocks(-5, -2, 8, -2, 0, 11, 42, tag = "ethernet")
        #camera, display, power, hdmi, composite ports
        self.setBlocks(-5, -2, 1, -2, -2, 1, 35, 15, tag = "camera")
        self.setBlocks(2, -2, -9, -1, -2, -9, 35, 15, tag = "display")
        self.setBlocks(-6, -2, -7, -6, -2, -6, 42, tag = "power")
        self.setBlocks(-6, -2, -2, -6, -2, 0, 42, tag = "hdmi")
        self.setBlock(-6, -2, 3, 35, 15, tag = "composite")
        #processor
        self.setBlocks(0, -2, -2, 2, -2, -4, 35, 15, tag = "processor")
        #led grid
        self.setBlocks(-3, 1, -8, 4, 1, -1, 35, 0, tag = "led")
        #other astro pi components
        self.setBlocks(3, 1, 1, 4, 1, 2, 35, 15, tag = "level_shifter")
        self.setBlocks(3, 1, 4, 4, 1, 5, 35, 15, tag = "atmel" )
        self.setBlocks(0, 1, 1, 0, 1, 2, 35, 15, tag = "orientation")
        self.setBlock(1, 1, 5, 35, 15, tag = "humidity")
        self.setBlock(-1, 1, 5, 35, 15, tag = "pressure")
        self.setBlock(-2, 1, 3, 35, 15, tag = "eeprom")
        self.setBlocks(-6, 1, -5, -5, 1, -4, 35, 15, tag = "led_driver")
        #astropi joystick
        self.setBlock(-5, 1, 4, 42, tag = "joy_left")
        self.setBlock(-4, 1, 5, 42, tag = "joy_up")
        self.setBlock(-5, 1, 6, 42, tag = "joy_right")
        self.setBlock(-6, 1, 5, 42, tag = "joy_down")
        self.setBlock(-5, 2, 5, 35, 15, tag = "joy_button")
        #astro pi gaps
        self.setBlocks(-1, 0, -9, 2, 0, -9, 0)
        self.setBlocks(-5, 0, 1, -2, 0, 1, 0)
        
        if cleararea:
            self.clearArea()

        #make the model visible
        if makevisible:
            self.draw()
예제 #4
0
    def __init__(self, mc, pos, cleararea=True, makevisible=True):

        self.pos = pos
        self.mc = mc

        #init the MinecraftShape
        MinecraftShape.__init__(self, self.mc, self.pos, visible=False)

        #create the AstroPi using setBlock(s) commands

        #boards
        self.setBlocks(-6, -3, -9, 7, -3, 11, 35, 13, tag="rpi_board")
        self.setBlocks(-6, 0, -9, 7, 0, 6, 35, 13, tag="astropi_board")
        #pillars
        self.setBlocks(-6, -2, -9, -6, -1, -9, 42)
        self.setBlocks(7, -2, -9, 7, -1, -9, 42)
        self.setBlocks(-6, -2, 6, -6, -1, 6, 42)
        self.setBlocks(7, -2, 6, 7, -1, 6, 42)
        #gpio headers
        self.setBlocks(7, 1, -8, 7, 1, 5, 35, 15, tag="astropi_gpio")
        self.setBlocks(7, -2, -8, 7, -1, 5, 35, 15, tag="rpi_gpio")
        #usb and ethernet port
        self.setBlocks(4, -2, 8, 6, 0, 11, 42, tag="usb")
        self.setBlocks(0, -2, 8, 2, 0, 11, 42, tag="usb")
        self.setBlocks(-5, -2, 8, -2, 0, 11, 42, tag="ethernet")
        #camera, display, power, hdmi, composite ports
        self.setBlocks(-5, -2, 1, -2, -2, 1, 35, 15, tag="camera")
        self.setBlocks(2, -2, -9, -1, -2, -9, 35, 15, tag="display")
        self.setBlocks(-6, -2, -7, -6, -2, -6, 42, tag="power")
        self.setBlocks(-6, -2, -2, -6, -2, 0, 42, tag="hdmi")
        self.setBlock(-6, -2, 3, 35, 15, tag="composite")
        #processor
        self.setBlocks(0, -2, -2, 2, -2, -4, 35, 15, tag="processor")
        #led grid
        self.setBlocks(-3, 1, -8, 4, 1, -1, 35, 0, tag="led")
        #other astro pi components
        self.setBlocks(3, 1, 1, 4, 1, 2, 35, 15, tag="level_shifter")
        self.setBlocks(3, 1, 4, 4, 1, 5, 35, 15, tag="atmel")
        self.setBlocks(0, 1, 1, 0, 1, 2, 35, 15, tag="orientation")
        self.setBlock(1, 1, 5, 35, 15, tag="humidity")
        self.setBlock(-1, 1, 5, 35, 15, tag="pressure")
        self.setBlock(-2, 1, 3, 35, 15, tag="eeprom")
        self.setBlocks(-6, 1, -5, -5, 1, -4, 35, 15, tag="led_driver")
        #astropi joystick
        self.setBlock(-5, 1, 4, 42, tag="joy_left")
        self.setBlock(-4, 1, 5, 42, tag="joy_up")
        self.setBlock(-5, 1, 6, 42, tag="joy_right")
        self.setBlock(-6, 1, 5, 42, tag="joy_down")
        self.setBlock(-5, 2, 5, 35, 15, tag="joy_button")
        #astro pi gaps
        self.setBlocks(-1, 0, -9, 2, 0, -9, 0)
        self.setBlocks(-5, 0, 1, -2, 0, 1, 0)

        if cleararea:
            self.clearArea()

        #make the model visible
        if makevisible:
            self.draw()
예제 #5
0
    def __init__(self, mc, pos, cleararea=True, makevisible=True):

        self.pos = pos
        self.mc = mc

        #init the MinecraftShape
        MinecraftShape.__init__(self, self.mc, self.pos, visible=False)

        #create the arrow using setBlock(s) commands
        #red wool fire!
        self.setBlock(0, 0, 0, 35, 14)
        #block wool wings
        self.setBlocks(-2, 1, 0, 2, 1, 0, 35, 15)
        self.setBlocks(0, 1, -2, 0, 1, 2, 35, 15)
        self.setBlocks(0, 2, -1, 0, 2, 1, 35, 15)
        self.setBlocks(-1, 2, 0, 1, 2, 0, 35, 15)
        #white steps on wings
        self.setBlock(-3, 1, 0, 156)
        self.setBlock(-2, 2, 0, 156)
        self.setBlock(0, 1, -3, 156, 2)
        self.setBlock(0, 2, -2, 156, 2)
        self.setBlock(3, 1, 0, 156, 1)
        self.setBlock(2, 2, 0, 156, 1)
        self.setBlock(0, 1, 3, 156, 3)
        self.setBlock(0, 2, 2, 156, 3)
        #white base
        self.setBlocks(1, 3, 0, -1, 3, 0, 155)
        self.setBlocks(0, 3, 1, 0, 3, -1, 155)
        #black band
        self.setBlocks(1, 4, 0, -1, 4, 0, 35, 15)
        self.setBlocks(0, 4, 1, 0, 4, -1, 35, 15)
        #main body
        self.setBlocks(0, 5, -1, 0, 10, -1, 155)
        self.setBlocks(-1, 10, 0, -1, 5, 0, 155)
        self.setBlocks(0, 5, 1, 0, 10, 1, 155)
        self.setBlocks(1, 10, 0, 1, 5, 0, 155)
        #white steps at the top
        self.setBlock(1, 11, 0, 156, 1)
        self.setBlock(0, 11, 1, 156, 3)
        self.setBlock(-1, 11, 0, 156)
        self.setBlock(0, 11, -1, 156, 2)
        #block on the top
        self.setBlock(0, 12, 0, 155)

        if cleararea:
            self.clearArea()

        #make the model visible
        if makevisible:
            self.draw()
예제 #6
0
    def __init__(self, mc, pos, cleararea = True, makevisible = True):

        self.pos = pos
        self.mc = mc

        #init the MinecraftShape
        MinecraftShape.__init__(self, self.mc, self.pos, visible = False)

        #create the arrow using setBlock(s) commands
        #red wool fire!
        self.setBlock(0, 0, 0, 35, 14)
        #block wool wings
        self.setBlocks(-2, 1, 0, 2, 1, 0, 35, 15)
        self.setBlocks(0, 1, -2, 0, 1, 2, 35, 15)
        self.setBlocks(0, 2, -1, 0, 2, 1, 35, 15)
        self.setBlocks(-1, 2, 0, 1, 2, 0, 35, 15)
        #white steps on wings
        self.setBlock(-3, 1, 0, 156)
        self.setBlock(-2, 2, 0, 156)
        self.setBlock(0, 1, -3, 156, 2)
        self.setBlock(0, 2, -2, 156, 2)
        self.setBlock(3, 1, 0, 156, 1)
        self.setBlock(2, 2, 0, 156, 1)
        self.setBlock(0, 1, 3, 156, 3)
        self.setBlock(0, 2, 2, 156, 3)
        #white base
        self.setBlocks(1, 3, 0, -1, 3, 0, 155)
        self.setBlocks(0, 3, 1, 0, 3, -1, 155)
        #black band
        self.setBlocks(1, 4, 0, -1, 4, 0, 35, 15)
        self.setBlocks(0, 4, 1, 0, 4, -1, 35, 15)
        #main body
        self.setBlocks(0, 5, -1, 0, 10, -1, 155)
        self.setBlocks(-1, 10, 0, -1, 5, 0, 155)
        self.setBlocks(0, 5, 1, 0, 10, 1, 155)
        self.setBlocks(1, 10, 0, 1, 5, 0, 155)
        #white steps at the top
        self.setBlock(1, 11, 0, 156, 1)
        self.setBlock(0, 11, 1, 156, 3)
        self.setBlock(-1, 11, 0, 156)
        self.setBlock(0, 11, -1, 156, 2)
        #block on the top
        self.setBlock(0, 12, 0, 155)

        if cleararea:
            self.clearArea()

        #make the model visible
        if makevisible:
            self.draw()
예제 #7
0
    def __init__(self, mc, pos, cleararea=True, makevisible=True):

        self.pos = pos
        self.mc = mc

        #init the MinecraftShape
        MinecraftShape.__init__(self, self.mc, self.pos, visible=False)

        #create the arrow using setBlock(s) commands
        # an arrow
        self.setBlocks(0, 0, -5, 0, 0, 5, block.WOOL.id, 1)
        self.setBlocks(1, 0, -4, 1, 0, -4, block.WOOL.id, 2)
        self.setBlocks(-1, 0, -4, -1, 0, -4, block.WOOL.id, 2)
        self.setBlocks(2, 0, -3, 2, 0, -3, block.WOOL.id, 3)
        self.setBlocks(-2, 0, -3, -2, 0, -3, block.WOOL.id, 3)
        self.setBlocks(3, 0, -2, 3, 0, -2, block.WOOL.id, 4)
        self.setBlocks(-3, 0, -2, -3, 0, -2, block.WOOL.id, 4)

        if cleararea:
            self.clearArea()

        #make the model visible
        if makevisible:
            self.draw()
예제 #8
0
    def __init__(self, mc, pos, cleararea = True, makevisible = True):

        self.pos = pos
        self.mc = mc

        #init the MinecraftShape
        MinecraftShape.__init__(self, self.mc, self.pos, visible = False)

        #create the arrow using setBlock(s) commands
        # an arrow
        self.setBlocks(0, 0, -5, 0, 0, 5, block.WOOL.id, 1)
        self.setBlocks(1, 0, -4, 1, 0, -4, block.WOOL.id, 2)
        self.setBlocks(-1, 0, -4, -1, 0, -4, block.WOOL.id, 2)
        self.setBlocks(2, 0, -3, 2, 0, -3, block.WOOL.id, 3)
        self.setBlocks(-2, 0, -3, -2, 0, -3, block.WOOL.id, 3)
        self.setBlocks(3, 0, -2, 3, 0, -2, block.WOOL.id, 4)
        self.setBlocks(-3, 0, -2, -3, 0, -2, block.WOOL.id, 4)
        
        if cleararea:
            self.clearArea()

        #make the model visible
        if makevisible:
            self.draw()
예제 #9
0
#create the shape object
bt = "diamond_block"
shapeBlocks = [
    ShapeBlock(0, 0, 0, bt),
    ShapeBlock(1, 0, 0, bt),
    ShapeBlock(1, 0, 1, bt),
    ShapeBlock(0, 0, 1, bt),
    ShapeBlock(0, 1, 0, bt),
    ShapeBlock(1, 1, 0, bt),
    ShapeBlock(1, 1, 1, bt),
    ShapeBlock(0, 1, 1, bt)
]

#move the shape about
myShape = MinecraftShape(mc, playerPos, shapeBlocks)
print("drawn shape")
time.sleep(10)
myShape.moveBy(-1, 1, -1)
time.sleep(1)
myShape.moveBy(1, 0, 1)
time.sleep(1)
myShape.moveBy(1, 1, 0)
time.sleep(1)

#rotate the shape
myShape.rotate(90, 0, 0)

#clear the shape
myShape.clear()
예제 #10
0
from mcpi.minecraft import Minecraft
from mcpi import block
from minecraftstuff import MinecraftShape

mc = Minecraft.create()

pos = mc.player.getTilePos()

myShape = MinecraftShape(mc, pos)

# create a big cube
myShape.setBlocks(-5, -5, -5, 5, 5, 5, block.WOOL.id, 5)

#move it 10 blocks up
myshape.moveBy(0, 10, 0)

#rotate it 45 degrees
myshape.rotate(45, 0, 0)

#### XXXXXXX
예제 #11
0
#test MinecraftShape
playerPos = mc.player.getTilePos()

#create the shape object
shapeBlocks = [ShapeBlock(0,0,0,block.DIAMOND_BLOCK.id),
                ShapeBlock(1,0,0,block.DIAMOND_BLOCK.id),
                ShapeBlock(1,0,1,block.DIAMOND_BLOCK.id),
                ShapeBlock(0,0,1,block.DIAMOND_BLOCK.id),
                ShapeBlock(0,1,0,block.DIAMOND_BLOCK.id),
                ShapeBlock(1,1,0,block.DIAMOND_BLOCK.id),
                ShapeBlock(1,1,1,block.DIAMOND_BLOCK.id),
                ShapeBlock(0,1,1,block.DIAMOND_BLOCK.id)]

#move the shape about
myShape = MinecraftShape(mc, playerPos, shapeBlocks)
print("drawn shape")
time.sleep(10)
myShape.moveBy(-1,1,-1)
time.sleep(1)
myShape.moveBy(1,0,1)
time.sleep(1)
myShape.moveBy(1,1,0)
time.sleep(1)

#rotate the shape
myShape.rotate(90,0,0)

#clear the shape
myShape.clear()
예제 #12
0
    def __init__(self, mc, pos, cleararea=True, makevisible=True):

        self.pos = pos
        self.mc = mc

        #init the MinecraftShape
        MinecraftShape.__init__(self, self.mc, self.pos, visible=False)

        #create the ISS using setBlock(s) commands

        #main body
        self.setBlocks(-2, 0, -16, -2, 0, 16, 42)
        self.setBlocks(-1, -1, 16, -1, -1, -16, 42)
        self.setBlocks(0, -2, -16, 0, -2, 16, 42)
        self.setBlocks(1, -1, 16, 1, -1, -16, 42)
        self.setBlocks(2, 0, -16, 2, 0, 16, 42)
        self.setBlocks(1, 1, 16, 1, 1, -16, 42)
        self.setBlocks(0, 2, -16, 0, 2, 16, 42)
        self.setBlocks(-1, 1, 16, -1, 1, -16, 42)
        self.setBlocks(1, 0, -17, -1, 0, -17, 42)
        self.setBlocks(0, 1, -17, 0, -1, -17, 42)
        self.setBlocks(0, 1, 17, 0, -1, 17, 42)
        self.setBlocks(-1, 0, 17, 1, 0, 17, 42)
        #across
        self.setBlocks(-12, -1, 0, 7, -1, 0, 42)
        self.setBlocks(-12, 0, 1, 8, 0, 1, 42)
        self.setBlocks(7, 1, 0, -12, 1, 0, 42)
        self.setBlocks(-12, 0, -1, 8, 0, -1, 42)
        self.setBlock(-13, 0, 0, 42)
        #bit on top of the across
        self.setBlock(-13, 0, 0, 42)
        self.setBlock(-10, 1, -1, 42)
        self.setBlock(-10, 2, 0, 42)
        self.setBlock(-10, 1, 1, 42)
        self.setBlock(-5, 1, 1, 42)
        self.setBlock(-5, 1, -1, 42)
        #central spire
        self.setBlocks(-1, 2, 0, -1, 4, 0, 42)
        self.setBlocks(0, 3, -1, 0, 4, -1, 42)
        self.setBlocks(1, 2, 0, 1, 4, 0, 42)
        self.setBlocks(0, 3, 1, 0, 4, 1, 42)
        self.setBlock(0, 5, 0, 42)
        #the T
        self.setBlocks(7, 1, -5, 7, 1, 4, 42)
        self.setBlocks(8, 0, 4, 8, 0, -5, 42)
        self.setBlocks(6, 0, -5, 6, 0, 4, 42)
        self.setBlocks(7, -1, 4, 7, -1, -5, 42)
        self.setBlock(7, 0, -6, 42)
        self.setBlock(7, 0, 5, 42)
        #solar panel supports
        self.setBlocks(14, 0, 14, 3, 0, 14, 42)
        self.setBlocks(3, 0, 9, 14, 0, 9, 42)
        self.setBlocks(14, 0, -10, 3, 0, -10, 42)
        self.setBlocks(3, 0, -14, 14, 0, -14, 42)
        self.setBlocks(-3, 0, -14, -15, 0, -14, 42)
        self.setBlocks(-15, 0, -10, -3, 0, -10, 42)
        self.setBlocks(-3, 0, 9, -14, 0, 9, 42)
        self.setBlocks(-14, 0, 14, -3, 0, 14, 42)
        #solar panels
        self.setBlocks(-4, 0, 15, -15, 0, 15, 35, 1)
        self.setBlocks(-15, 0, 13, -4, 0, 13, 35, 1)
        self.setBlocks(-4, 0, 10, -15, 0, 10, 35, 1)
        self.setBlocks(-15, 0, 8, -4, 0, 8, 35, 1)
        self.setBlocks(-4, 0, -9, -16, 0, -9, 35, 1)
        self.setBlocks(-16, 0, -11, -4, 0, -11, 35, 1)
        self.setBlocks(-4, 0, -13, -16, 0, -13, 35, 1)
        self.setBlocks(-16, 0, -15, -4, 0, -15, 35, 1)
        self.setBlocks(4, 0, -15, 15, 0, -15, 35, 1)
        self.setBlocks(15, 0, -13, 4, 0, -13, 35, 1)
        self.setBlocks(4, 0, -11, 15, 0, -11, 35, 1)
        self.setBlocks(15, 0, -9, 4, 0, -9, 35, 1)
        self.setBlocks(4, 0, 8, 15, 0, 8, 35, 1)
        self.setBlocks(15, 0, 10, 4, 0, 10, 35, 1)
        self.setBlocks(4, 0, 13, 15, 0, 13, 35, 1)
        self.setBlocks(15, 0, 15, 4, 0, 15, 35, 1)

        if cleararea:
            self.clearArea()

        #make the model visible
        if makevisible:
            self.draw()
예제 #13
0
def main ():
    # disegna_assi ( pos )
    pos = trova_pos_player ()

    # un po' di pulizia
    mc.setBlocks ( pos.x, pos.y, pos.z, pos.x + 25, pos.y + 25, pos.z + 25, 0 )

    # muri
    muro = MinecraftShape ( mc, pos )
    muro.setBlocks ( 0, 0, 0, 10, 20, 0, block.STONE.id )
    muro.setBlocks ( 10, 0, 0, 10, 20, 10, block.STONE.id )
    muro.setBlocks ( 0, 0, 0, 0, 20, 10, block.STONE.id )
    muro.setBlocks ( 0, 0, 10, 10, 20, 10, block.STONE.id )
    # porta
    muro.setBlocks ( 3, 0, 10, 7, 10, 10, 0 )

    # pale del mulino
    davanti_pos = Vec3 ( pos.x + 5, pos.y + 15, pos.z + 11 )
    pale = MinecraftShape ( mc, davanti_pos )
    pale.setBlocks( -10, 0, 0, 10, 0, 0, block.BEDROCK.id )
    pale.setBlocks( 0, -10, 0, 0, 10, 0, block.BEDROCK.id )


    # animiamo le pale
    while 1:
        pale.rotateBy ( 0, 0, 10 )
        time.sleep ( 1 )
예제 #14
0
import path_helper
from minecraftstuff import MinecraftShape
import mcpi.minecraft as minecraft
import time

#connect to minecraft
mc = minecraft.Minecraft.create()

#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, "white_wool")
    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)
예제 #15
0
    def __init__(self, mc, pos, cleararea = True, makevisible = True):

        self.pos = pos
        self.mc = mc

        #init the MinecraftShape
        MinecraftShape.__init__(self, self.mc, self.pos, visible = False)

        #create the ISS using setBlock(s) commands
        
        #main body
        self.setBlocks(-2, 0, -16, -2, 0, 16, 42)
        self.setBlocks(-1, -1, 16, -1, -1, -16, 42)
        self.setBlocks(0, -2, -16, 0, -2, 16, 42)
        self.setBlocks(1, -1, 16, 1, -1, -16, 42)
        self.setBlocks(2, 0, -16, 2, 0, 16, 42)
        self.setBlocks(1, 1, 16, 1, 1, -16, 42)
        self.setBlocks(0, 2, -16, 0, 2, 16, 42)
        self.setBlocks(-1, 1, 16, -1, 1, -16, 42)
        self.setBlocks(1, 0, -17, -1, 0, -17, 42)
        self.setBlocks(0, 1, -17, 0, -1, -17, 42)
        self.setBlocks(0, 1, 17, 0, -1, 17, 42)
        self.setBlocks(-1, 0, 17, 1, 0, 17, 42)
        #across 
        self.setBlocks(-12, -1, 0, 7, -1, 0, 42)
        self.setBlocks(-12, 0, 1, 8, 0, 1, 42)
        self.setBlocks(7, 1, 0, -12, 1, 0, 42)
        self.setBlocks(-12, 0, -1, 8, 0, -1, 42)
        self.setBlock(-13, 0, 0, 42)
        #bit on top of the across
        self.setBlock(-13, 0, 0, 42)
        self.setBlock(-10, 1, -1, 42)
        self.setBlock(-10, 2, 0, 42)
        self.setBlock(-10, 1, 1, 42)
        self.setBlock(-5, 1, 1, 42)
        self.setBlock(-5, 1, -1, 42)
        #central spire
        self.setBlocks(-1, 2, 0, -1, 4, 0, 42)
        self.setBlocks(0, 3, -1, 0, 4, -1, 42)
        self.setBlocks(1, 2, 0, 1, 4, 0, 42)
        self.setBlocks(0, 3, 1, 0, 4, 1, 42)
        self.setBlock(0, 5, 0, 42)
        #the T
        self.setBlocks(7, 1, -5, 7, 1, 4, 42)
        self.setBlocks(8, 0, 4, 8, 0, -5, 42)
        self.setBlocks(6, 0, -5, 6, 0, 4, 42)
        self.setBlocks(7, -1, 4, 7, -1, -5, 42)
        self.setBlock(7, 0, -6, 42)
        self.setBlock(7, 0, 5, 42)
        #solar panel supports
        self.setBlocks(14, 0, 14, 3, 0, 14, 42)
        self.setBlocks(3, 0, 9, 14, 0, 9, 42)
        self.setBlocks(14, 0, -10, 3, 0, -10, 42)
        self.setBlocks(3, 0, -14, 14, 0, -14, 42)
        self.setBlocks(-3, 0, -14, -15, 0, -14, 42)
        self.setBlocks(-15, 0, -10, -3, 0, -10, 42)
        self.setBlocks(-3, 0, 9, -14, 0, 9, 42)
        self.setBlocks(-14, 0, 14, -3, 0, 14, 42)
        #solar panels
        self.setBlocks(-4, 0, 15, -15, 0, 15, 35, 1)
        self.setBlocks(-15, 0, 13, -4, 0, 13, 35, 1)
        self.setBlocks(-4, 0, 10, -15, 0, 10, 35, 1)
        self.setBlocks(-15, 0, 8, -4, 0, 8, 35, 1)
        self.setBlocks(-4, 0, -9, -16, 0, -9, 35, 1)
        self.setBlocks(-16, 0, -11, -4, 0, -11, 35, 1)
        self.setBlocks(-4, 0, -13, -16, 0, -13, 35, 1)
        self.setBlocks(-16, 0, -15, -4, 0, -15, 35, 1)
        self.setBlocks(4, 0, -15, 15, 0, -15, 35, 1)
        self.setBlocks(15, 0, -13, 4, 0, -13, 35, 1)
        self.setBlocks(4, 0, -11, 15, 0, -11, 35, 1)
        self.setBlocks(15, 0, -9, 4, 0, -9, 35, 1)
        self.setBlocks(4, 0, 8, 15, 0, 8, 35, 1)
        self.setBlocks(15, 0, 10, 4, 0, 10, 35, 1)
        self.setBlocks(4, 0, 13, 15, 0, 13, 35, 1)
        self.setBlocks(15, 0, 15, 4, 0, 15, 35, 1)

        if cleararea:
            self.clearArea()

        #make the model visible
        if makevisible:
            self.draw()
예제 #16
0
#testing models in MinecraftShapes and different ways of creating hthem
from mcpi.minecraft import Minecraft
from minecraftstuff import MinecraftShape, ShapeBlock
from time import sleep

mc = Minecraft.create()

pos = mc.player.getTilePos()
pos2 = mc.player.getTilePos()
pos2.y = pos2.y + 2

print("create shape 1")
#s1 = MinecraftShape(mc, pos, [ShapeBlock(0,0,0,1)])
s1 = MinecraftShape(mc, pos)
s1.setBlock(0,0,0,1)
print(s1.shapeBlocks)

sleep(5)

print("create shape 2")
#s2 = MinecraftShape(mc, pos2, [ShapeBlock(0,0,0,2)])
s2 = MinecraftShape(mc, pos2)
s2.setBlock(0,0,0,2)
print(s2.shapeBlocks)

sleep(5)

print("clear shape 1")
s1.clear()

sleep(5)
from minecraftstuff import MinecraftShape
import mcpi.minecraft as minecraft
import mcpi.block as block
import time

#connect to minecraft
mc = minecraft.Minecraft.create()

#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)
예제 #18
0
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: