diff --git a/raspberryjammod/mcpipy/ltree.py b/raspberryjammod/mcpipy/ltree.py index a6f6461..81e215a 100644 --- a/raspberryjammod/mcpipy/ltree.py +++ b/raspberryjammod/mcpipy/ltree.py @@ -1,4 +1,4 @@ -# +# # Code under the MIT license by Alexander Pruss # diff --git a/raspberryjammod/mcpipy/polyhedron.py b/raspberryjammod/mcpipy/polyhedron.py index ad960f9..545d957 100644 --- a/raspberryjammod/mcpipy/polyhedron.py +++ b/raspberryjammod/mcpipy/polyhedron.py @@ -1,5 +1,5 @@ #The software in this file is copyright 2003,2004 Simon Tatham and copyright 2015 Alexander Pruss -#Based on code from # http://www.chiark.greenend.org.uk/~sgtatham/polyhedra/ +#Based on code from http://www.chiark.greenend.org.uk/~sgtatham/polyhedra/ # #Permission is hereby granted, free of charge, to any person #obtaining a copy of this software and associated documentation files @@ -755,4 +755,3 @@ if __name__ == "__main__": pos = d.mc.player.getPos() polyhedron(d,n,faceMode,pos.x, pos.y, pos.z, size,drawing.GLASS,drawing.STONE) - diff --git a/raspberryjammod/mcpipy/render.py b/raspberryjammod/mcpipy/render.py index a734e70..96b29ac 100644 --- a/raspberryjammod/mcpipy/render.py +++ b/raspberryjammod/mcpipy/render.py @@ -851,4 +851,4 @@ if __name__ == "__main__": mainloop() else: - go("models/" + sys.argv[1] + ".txt", sys.argv[2:]) + go(os.path.dirname(os.path.realpath(sys.argv[0])) + "/" + "models/" + sys.argv[1] + ".txt", sys.argv[2:]) diff --git a/raspberryjammod/mcpipy/sierpinski3d.py b/raspberryjammod/mcpipy/sierpinski3d.py index 482425d..f126aa7 100644 --- a/raspberryjammod/mcpipy/sierpinski3d.py +++ b/raspberryjammod/mcpipy/sierpinski3d.py @@ -6,12 +6,19 @@ from mc import * import drawing from sys import argv import mcpi.settings as settings +import ast RAINBOW = (WOOL_RED,WOOL_PINK,WOOL_ORANGE,WOOL_YELLOW,WOOL_GREEN,WOOL_BLUE,WOOL_LIGHT_BLUE,WOOL_PURPLE) TAN30 = sqrt(3.)/3 SQRT32 = sqrt(3./2) +def parseBlock(s): + try: + return ast.literal_eval(s) + except: + return globals()[s.upper()] + def distance(a,b): return sqrt((a[0]-b[0])**2+(a[1]-b[1])**2+(a[2]-b[2])**2) @@ -59,7 +66,8 @@ mc.player.setPos(tetrahedronBottom(height,(pos.x,pos.y+height,pos.z))[0]) tetrahedra = sierpinski(height,pos.x,pos.y+height,pos.z,levels) mc.postToChat("Drawing") if len(argv) >= 2 and '__' not in argv[1]: - block = lambda level : eval(argv[1]) + specifiedBlock = parseBlock(argv[1]) + block = lambda level : specifiedBlock else: block = lambda level : RAINBOW[level % len(RAINBOW)] for tet in tetrahedra: