예제 #1
0
        #clear hand
        drawMinuteHand(mc, clockCentre, lastTime.minute, block.AIR)
        #new hand
        drawMinuteHand(mc, clockCentre, time.minute, block.STONE)

    #draw second hand
    if (lastTime.second != time.second):
        #clear hand
        drawSecondHand(mc, clockCentre, lastTime.second, block.AIR)
        #new hand
        drawSecondHand(mc, clockCentre, time.second, block.WOOD_PLANKS)


if __name__ == "__main__":

    clockCentre = Minecraft.Vec3(0, 30, 0)
    radius = 20
    time.sleep(5)
    #Connect to minecraft by creating the minecraft object
    # - minecraft needs to be running and in a game
    #    mc = Minecraft.Minecraft.create(ip)
    mc = Minecraft.create(ip)

    #Post a message to the minecraft chat window
    mc.postToChat("Hi, Minecraft Analogue Clock, www.stuffaboutcode.com")

    time.sleep(2)

    lastTime = datetime.datetime.now()
    #draw the clock
    drawClock(mc, clockCentre, radius, lastTime)