コード例 #1
0
    mc.postToChat("SpaceCRAFT - Minecraft Rocket Launch")
    mc.postToChat("Hit the launch pad")
    
    #create the rocket next to the player at ground level
    rocketPos = mc.player.getTilePos()
    rocketPos.x += 5
    rocketPos.y = mc.getHeight(rocketPos.x, rocketPos.z) - 1
    launchpad = LaunchPad(mc, rocketPos)
    rocket = Rocket(mc, rocketPos)
    
    try:
        #wait till the launch tnt is hit
        launch = False
        while not launch:
            for hit in mc.events.pollBlockHits():
                shapeblockhit = launchpad.getShapeBlock(
                    hit.pos.x, hit.pos.y, hit.pos.z)
                
                if shapeblockhit != None:
                    
                    if shapeblockhit.tag == "launch":
                        launch = True
                
        #count down to blast off
        for count in range(3, 0, -1):
            mc.postToChat(str(count))
            sleep(1)
        mc.postToChat("Blast Off")

        #launch the rocket
        for up in range(0, 15):
            rocket.moveBy(0, 1, 0)