示例#1
0
def main():
    try:
        server = Server(MC_SEVER_HOST, MC_SEVER_PORT)
        # Filename with the scene that will be loaded
        scene_path = "scene_sphere_drawing.mct"

        server.mc.postToChat("Building a scene from " + scene_path)
        pos = server.mc.entity.getTilePos(server.mc.getPlayerEntityId(BUILDER_NAME))
        pos.z += 10

        # Let's load the scene and build it
        Scene.load(scene_path)
        # List of things in the scene
        Scene.server.postToChat(Scene.things)
        # Position the scene to the player position
        Scene.reposition(pos)
        Scene.build()

    except mcpi.connection.RequestError:
        print("Can't connect to Minecraft server " + MC_SEVER_HOST)
示例#2
0
def main():
    try:
        server = Server(MC_SEVER_HOST, MC_SEVER_PORT)
        scene_path = "scene_sphere_drawing.mct"

        server.mc.postToChat("Building a scene from " + scene_path)
        pos = server.mc.entity.getTilePos(
            server.mc.getPlayerEntityId(BUILDER_NAME))
        pos.z += 10

        server.mc.postToChat("Cleaning a scene")

        # Let's load the scene and build it
        Scene.load(scene_path)
        # Move the scene to the player position
        Scene.reposition(pos)
        Scene.build()
        time.sleep(3)
        Scene.unbuild()

    except mcpi.connection.RequestError:
        print("Can't connect to Minecraft server " + MC_SEVER_HOST)