forked from shawt/minecraft-stuff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
minecraftstuff.py
executable file
·743 lines (617 loc) · 25.5 KB
/
minecraftstuff.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
#www.stuffaboutcode.com
#github.com/martinohanlon/minecraft-stuff
#Raspberry Pi, Minecraft - Minecraft 'stuff' extensions
try:
import mcpi.minecraft as minecraft
import mcpi.block as block
import mcpi.util as util
except ImportError:
import minecraft
import block
import util
from copy import deepcopy
import time
import math
class MinecraftDrawing:
"""
MinecraftDrawing - a class of 'useful' drawing functions
"""
def __init__(self, mc):
self.mc = mc
def drawPoint3d(self, x, y, z, blockType, blockData=0):
"""
draws a single point in Minecraft, i.e. 1 block
"""
self.mc.setBlock(x,y,z,blockType,blockData)
#print "x = " + str(x) + ", y = " + str(y) + ", z = " + str(z)
def drawFace(self, vertices, filled, blockType, blockData=0):
"""
draws a face, when passed a collection of vertices which make up a polyhedron
"""
# get the edges of the face
edgesVertices = []
# persist the first vertex
firstVertex = vertices[0]
# get the last vertex
lastVertex = vertices[0]
# loop through vertices and get edges
for vertex in vertices[1:]:
# get the points for the edge
edgesVertices = edgesVertices + self.getLine(lastVertex.x, lastVertex.y, lastVertex.z, vertex.x, vertex.y, vertex.z)
# persist the last vertex found
lastVertex = vertex
# get edge between the last and first vertices, so the polyhedron 'joins up'
edgesVertices = edgesVertices + self.getLine(lastVertex.x, lastVertex.y, lastVertex.z, firstVertex.x, firstVertex.y, firstVertex.z)
if (filled):
#draw solid face
# this algorithm isnt very efficient, but it does always fill the gap
# sort the edges vertices
def keyX( point ): return point.x
def keyY( point ): return point.y
def keyZ( point ): return point.z
edgesVertices.sort( key=keyZ )
edgesVertices.sort( key=keyY )
edgesVertices.sort( key=keyX )
#draw lines between the points on the edges
lastVertex = edgesVertices[0]
for vertex in edgesVertices[1:]:
# got 2 vertices, draw lines between them
self.drawLine(lastVertex.x, lastVertex.y, lastVertex.z, vertex.x, vertex.y, vertex.z, blockType, blockData)
#print "x = " + str(lastVertex.x) + ", y = " + str(lastVertex.y) + ", z = " + str(lastVertex.z) + " x2 = " + str(vertex.x) + ", y2 = " + str(vertex.y) + ", z2 = " + str(vertex.z)
# persist the last vertex found
lastVertex = vertex
else:
#draw wireframe
self.drawVertices(edgesVertices, blockType, blockData)
def drawVertices(self, vertices, blockType, blockData=0):
"""
draws all the points in a collection of vertices with a block
"""
for vertex in vertices:
self.drawPoint3d(vertex.x, vertex.y, vertex.z, blockType, blockData)
def drawLine(self, x1, y1, z1, x2, y2, z2, blockType, blockData=0):
"""
draws a line between 2 points
"""
self.drawVertices(self.getLine(x1, y1, z1, x2, y2, z2), blockType, blockData)
def drawSphere(self, x1, y1, z1, radius, blockType, blockData=0):
"""
draws a sphere around a point to a radius
"""
for x in range(radius * -1, radius):
for y in range(radius * -1, radius):
for z in range(radius * -1, radius):
if x**2 + y**2 + z**2 < radius**2:
self.drawPoint3d(x1 + x, y1 + y, z1 + z, blockType, blockData)
def drawHollowSphere(self, x1, y1, z1, radius, blockType, blockData=0):
"""
draws a hollow sphere around a point to a radius, sphere has to bigger enough to be hollow!
"""
for x in range(radius * -1, radius):
for y in range(radius * -1, radius):
for z in range(radius * -1, radius):
if (x**2 + y**2 + z**2 < radius**2) and (x**2 + y**2 + z**2 > (radius**2 - (radius * 2))):
self.drawPoint3d(x1 + x, y1 + y, z1 +z, blockType, blockData)
def drawCircle(self, x0, y0, z, radius, blockType, blockData=0):
"""
draws a circle in the Y plane (i.e. vertically)
"""
f = 1 - radius
ddf_x = 1
ddf_y = -2 * radius
x = 0
y = radius
self.drawPoint3d(x0, y0 + radius, z, blockType, blockData)
self.drawPoint3d(x0, y0 - radius, z, blockType, blockData)
self.drawPoint3d(x0 + radius, y0, z, blockType, blockData)
self.drawPoint3d(x0 - radius, y0, z, blockType, blockData)
while x < y:
if f >= 0:
y -= 1
ddf_y += 2
f += ddf_y
x += 1
ddf_x += 2
f += ddf_x
self.drawPoint3d(x0 + x, y0 + y, z, blockType, blockData)
self.drawPoint3d(x0 - x, y0 + y, z, blockType, blockData)
self.drawPoint3d(x0 + x, y0 - y, z, blockType, blockData)
self.drawPoint3d(x0 - x, y0 - y, z, blockType, blockData)
self.drawPoint3d(x0 + y, y0 + x, z, blockType, blockData)
self.drawPoint3d(x0 - y, y0 + x, z, blockType, blockData)
self.drawPoint3d(x0 + y, y0 - x, z, blockType, blockData)
self.drawPoint3d(x0 - y, y0 - x, z, blockType, blockData)
def drawHorizontalCircle(self, x0, y, z0, radius, blockType, blockData=0):
"""
draws a circle in the X plane (i.e. horizontally)
"""
f = 1 - radius
ddf_x = 1
ddf_z = -2 * radius
x = 0
z = radius
self.drawPoint3d(x0, y, z0 + radius, blockType, blockData)
self.drawPoint3d(x0, y, z0 - radius, blockType, blockData)
self.drawPoint3d(x0 + radius, y, z0, blockType, blockData)
self.drawPoint3d(x0 - radius, y, z0, blockType, blockData)
while x < z:
if f >= 0:
z -= 1
ddf_z += 2
f += ddf_z
x += 1
ddf_x += 2
f += ddf_x
self.drawPoint3d(x0 + x, y, z0 + z, blockType, blockData)
self.drawPoint3d(x0 - x, y, z0 + z, blockType, blockData)
self.drawPoint3d(x0 + x, y, z0 - z, blockType, blockData)
self.drawPoint3d(x0 - x, y, z0 - z, blockType, blockData)
self.drawPoint3d(x0 + z, y, z0 + x, blockType, blockData)
self.drawPoint3d(x0 - z, y, z0 + x, blockType, blockData)
self.drawPoint3d(x0 + z, y, z0 - x, blockType, blockData)
self.drawPoint3d(x0 - z, y, z0 - x, blockType, blockData)
def getLine(self, x1, y1, z1, x2, y2, z2):
"""
Returns all the points which would make up a line between 2 points as a list
3d implementation of bresenham line algorithm
"""
# return the maximum of 2 values
def MAX(a,b):
if a > b: return a
else: return b
# return step
def ZSGN(a):
if a < 0: return -1
elif a > 0: return 1
elif a == 0: return 0
# list for vertices
vertices = []
# if the 2 points are the same, return single vertice
if (x1 == x2 and y1 == y2 and z1 == z2):
vertices.append(minecraft.Vec3(x1, y1, z1))
# else get all points in edge
else:
dx = x2 - x1
dy = y2 - y1
dz = z2 - z1
ax = abs(dx) << 1
ay = abs(dy) << 1
az = abs(dz) << 1
sx = ZSGN(dx)
sy = ZSGN(dy)
sz = ZSGN(dz)
x = x1
y = y1
z = z1
# x dominant
if (ax >= MAX(ay, az)):
yd = ay - (ax >> 1)
zd = az - (ax >> 1)
loop = True
while(loop):
vertices.append(minecraft.Vec3(x, y, z))
if (x == x2):
loop = False
if (yd >= 0):
y += sy
yd -= ax
if (zd >= 0):
z += sz
zd -= ax
x += sx
yd += ay
zd += az
# y dominant
elif (ay >= MAX(ax, az)):
xd = ax - (ay >> 1)
zd = az - (ay >> 1)
loop = True
while(loop):
vertices.append(minecraft.Vec3(x, y, z))
if (y == y2):
loop=False
if (xd >= 0):
x += sx
xd -= ay
if (zd >= 0):
z += sz
zd -= ay
y += sy
xd += ax
zd += az
# z dominant
elif(az >= MAX(ax, ay)):
xd = ax - (az >> 1)
yd = ay - (az >> 1)
loop = True
while(loop):
vertices.append(minecraft.Vec3(x, y, z))
if (z == z2):
loop=False
if (xd >= 0):
x += sx
xd -= az
if (yd >= 0):
y += sy
yd -= az
z += sz
xd += ax
yd += ay
return vertices
# MinecraftShape - a class for managing shapes
class MinecraftShape:
"""
MinecraftShape
The implementation of a 'shape' in Minecraft.
Each shape consists of one or many blocks with a position relative to each other.
Shapes can be transformed by movement and rotation.
When a shape is changed and redrawn in Minecraft only the blocks which have changed are updated.
"""
def __init__(self, mc, position, shapeBlocks = None, visible = True):
#persist the data
self.mc = mc
self.position = position
self.originalPos = self.position.clone()
if shapeBlocks == None:
self.shapeBlocks = []
else:
self.shapeBlocks = shapeBlocks
self.visible = visible
#setup properties
#drawnShapeBlocks is the last positions the shape was drawn too
self.drawnShapeBlocks = None
#set yaw, pitch, roll
self.yaw, self.pitch, self.roll = 0, 0, 0
#move the shape to its starting position
self._move(position.x, position.y, position.z)
def draw(self):
"""
draws the shape in Minecraft
taking into account where it was last drawn and only updates the blocks which have changed
"""
#create 2 sets only of the blocks which are drawn and one of the shapeBlocks
if self.drawnShapeBlocks == None:
drawnSet = set()
else:
drawnSet = set(self.drawnShapeBlocks)
currentSet = set(self.shapeBlocks)
#work out the blocks which need to be cleared
for blockToClear in drawnSet - currentSet:
self.mc.setBlock(blockToClear.actualPos.x, blockToClear.actualPos.y, blockToClear.actualPos.z, block.AIR.id)
#work out the blocks which have changed and need to be re-drawn
for blockToDraw in currentSet - drawnSet:
self.mc.setBlock(blockToDraw.actualPos.x, blockToDraw.actualPos.y, blockToDraw.actualPos.z, blockToDraw.blockType, blockToDraw.blockData)
#update the blocks which have been drawn
self.drawnShapeBlocks = deepcopy(self.shapeBlocks)
self.visible = True
def redraw(self):
"""
draws the shape in Minecraft, by clearing all the blocks and redrawing them
"""
if self.drawnShapeBlocks != None:
for blockToClear in self.drawnShapeBlocks:
self.mc.setBlock(blockToClear.actualPos.x, blockToClear.actualPos.y, blockToClear.actualPos.z, block.AIR.id)
for blockToDraw in self.shapeBlocks:
self.mc.setBlock(blockToDraw.actualPos.x, blockToDraw.actualPos.y, blockToDraw.actualPos.z, blockToDraw.blockType, blockToDraw.blockData)
#update the blocks which have been drawn
self.drawnShapeBlocks = deepcopy(self.shapeBlocks)
self.visible = True
def clear(self):
"""
clears the shape in Minecraft
"""
#clear the shape
if self.drawnShapeBlocks != None:
for blockToClear in self.drawnShapeBlocks:
self.mc.setBlock(blockToClear.actualPos.x,
blockToClear.actualPos.y,
blockToClear.actualPos.z,
block.AIR.id)
self.drawnShapeBlocks = None
self.visible = False
def reset(self):
"""
resets the shape back to its original position
"""
self.rotate(0,0,0)
self.move(self.originalPos.x, self.originalPos.y, self.originalPos.z)
def moveBy(self, x, y, z):
"""
moves the position of the shape by x,y,z
"""
return self._move(self.position.x + x, self.position.y + y, self.position.z + z)
def move(self, x, y, z):
"""
moves the position of the shape to x,y,z
"""
#is the position different
if self.position.x != x or self.position.y != y or self.position.z != z:
self.position.x = x
self.position.y = y
self.position.z = z
self._recalcBlocks()
if self.visible:
self.draw()
return True
else:
return False
def _move(self, x, y, z):
"""
Internal. moves the position of the shape to x,y,z
"""
self.position.x = x
self.position.y = y
self.position.z = z
self._recalcBlocks()
if self.visible:
self.draw()
def _recalcBlocks(self):
"""
recalculate the position of all of the blocks in a shape
"""
for shapeBlock in self.shapeBlocks:
self._recalcBlock(shapeBlock)
def _recalcBlock(self, shapeBlock):
"""
recalulate the shapeBlock's position based on its relative position,
its actual position in the world and its rotation
"""
#reset the block's position before recalcing it
shapeBlock.resetRelativePos()
#rotate the block
self._rotateShapeBlock(shapeBlock, self.yaw, self.pitch, self.roll)
#move the block
self._moveShapeBlock(shapeBlock, self.position.x, self.position.y, self.position.z)
def rotate(self, yaw, pitch, roll):
"""
sets the rotation of a shape by yaw, pitch and roll
"""
#is the rotation different?
if yaw != self.yaw or pitch != self.pitch or roll != self.roll:
#update values
self.yaw, self.pitch, self.roll = yaw, pitch, roll
#recalc all the block positions
self._recalcBlocks()
#if its visible redraw it
if self.visible:
self.draw()
return True
else:
return False
def rotateBy(self, yaw, pitch, roll):
"""
increments the rotation of a shape by yaw, pitch and roll
"""
return self.rotate(self.yaw + yaw, self.pitch + pitch, self.roll + roll)
def _moveShapeBlock(self, shapeBlock, x, y, z):
"""
offset the position of the block by the position
"""
shapeBlock.actualPos.x = shapeBlock.relativePos.x + x
shapeBlock.actualPos.y = shapeBlock.relativePos.y + y
shapeBlock.actualPos.z = shapeBlock.relativePos.z + z
def _rotateShapeBlock(self, shapeBlock, yaw, pitch, roll):
"""
rotate the block
"""
self._rotateShapeBlockY(shapeBlock, yaw)
self._rotateShapeBlockZ(shapeBlock, roll)
self._rotateShapeBlockX(shapeBlock, pitch)
def _rotateShapeBlockY(self, shapeBlock, theta):
"""
rotate y = yaw (direction)
"""
if theta != 0:
sin_t = math.sin(math.radians(theta))
cos_t = math.cos(math.radians(theta))
x = shapeBlock.relativePos.x * cos_t - shapeBlock.relativePos.z * sin_t
z = shapeBlock.relativePos.z * cos_t + shapeBlock.relativePos.x * sin_t
shapeBlock.relativePos.x = int(round(x,0))
shapeBlock.relativePos.z = int(round(z,0))
def _rotateShapeBlockZ(self, shapeBlock, theta):
"""
rotate z = roll
"""
if theta != 0:
sin_t = math.sin(math.radians(theta))
cos_t = math.cos(math.radians(theta))
x = shapeBlock.relativePos.x * cos_t - shapeBlock.relativePos.y * sin_t
y = shapeBlock.relativePos.y * cos_t + shapeBlock.relativePos.x * sin_t
shapeBlock.relativePos.x = int(round(x,0))
shapeBlock.relativePos.y = int(round(y,0))
def _rotateShapeBlockX(self, shapeBlock, theta):
"""
rotate x = pitch
"""
if theta != 0:
sin_t = math.sin(math.radians(theta))
cos_t = math.cos(math.radians(theta))
y = shapeBlock.relativePos.y * cos_t - shapeBlock.relativePos.z * sin_t
z = shapeBlock.relativePos.z * cos_t + shapeBlock.relativePos.y * sin_t
shapeBlock.relativePos.y = int(round(y,0))
shapeBlock.relativePos.z = int(round(z,0))
def setBlock(self, x, y, z, blockType, blockData = 0, tag = ""):
"""
sets one block in the shape and redraws it
"""
self._setBlock(x, y, z, blockType, blockData, tag)
#if the shape is visible (re)draw it
if self.visible:
self.draw()
def _setBlock(self, x, y, z, blockType, blockData, tag):
"""
sets one block in the shape
"""
#does the block already exist?
for shapeBlock in self.shapeBlocks:
if shapeBlock.originalPos.x == x and shapeBlock.originalPos.y == y and shapeBlock.originalPos.z == z:
#it does exist, update it
shapeBlock.blockType = blockType
shapeBlock.blockData = blockData
shapeBlock.tag= tag
break
else:
#it doesn't append it
newShapeBlock = ShapeBlock(x, y, z, blockType, blockData, tag)
self._recalcBlock(newShapeBlock)
self.shapeBlocks.append(newShapeBlock)
def setBlocks(self, x1, y1, z1, x2, y2, z2, blockType, blockData = 0, tag = ""):
"""
creates a cuboid of blocks in the shape and redraws it
"""
#order x, y, z's
if x1 > x2: x1, x2 = x2, x1
if y1 > y2: y1, y2 = y2, y1
if z1 > z2: z1, z2 = z2, z1
#create the cuboid
for x in range(x1, x2 + 1):
for y in range(y1, y2 + 1):
for z in range(z1, z2 + 1):
self._setBlock(x, y, z, blockType, blockData, tag)
#if the shape is visible (re)draw it
if self.visible:
self.draw()
def getShapeBlock(self, x, y, z):
"""
returns the shape block for an 'actual position'
"""
#does the block exist?
for shapeBlock in self.shapeBlocks:
if shapeBlock.actualPos.x == x and shapeBlock.actualPos.y == y and shapeBlock.actualPos.z == z:
return shapeBlock
else:
#it doesn't return None
return None
# a class created to manage a block within a shape
class ShapeBlock():
"""
ShapeBlock
a class to hold one block within a shape
"""
def __init__(self, x, y, z, blockType, blockData = 0, tag = ""):
#persist data
self.blockType = blockType
self.blockData = blockData
#store the positions
# original pos
self.originalPos = minecraft.Vec3(x, y, z)
# relative pos - block position relatively to other shape blocks
self.relativePos = minecraft.Vec3(x, y, z)
# actual pos - actual block position in the world
self.actualPos = minecraft.Vec3(x, y, z)
#the tag system is used to give a particular block inside a shape meaning
# e.g. for an animal shape you could tag the block which is its head
self.tag = tag
# the mc block object
self.mcBlock = block.Block(blockType, blockData)
def resetRelativePos(self):
"""
resets the relative position of the block back to its original position
"""
self.relativePos = self.originalPos.clone()
def __hash__(self):
return hash((self.actualPos.x, self.actualPos.y, self.actualPos.z, self.blockType, self.blockData))
def __eq__(self, other):
if other is None:
return False
else:
return (self.actualPos.x, self.actualPos.y, self.actualPos.z, self.blockType, self.blockData) == (other.actualPos.x, other.actualPos.y, other.actualPos.z, other.blockType, other.blockData)
# rotation test
if __name__ == "__main__2":
#connect to minecraft
mc = minecraft.Minecraft.create()
#test shape
pos = mc.player.getTilePos()
pos.y += 40
myShape = MinecraftShape(mc, pos)
try:
#myShape.setBlocks(-3, 0, 0, 3, 0, 0, block.WOOL.id, 2)
#myShape.setBlocks(0, -3, 0, 0, 3, 0, block.WOOL.id, 3)
#myShape.setBlocks(0, 0, -3, 0, 0, 3, block.WOOL.id, 4)
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)
for pitch in angles:
myShape.rotate(yaw, pitch, roll)
time.sleep(1)
for yaw in angles:
myShape.rotate(yaw, pitch, roll)
time.sleep(1)
for count in range(0,5):
myShape.moveBy(1,0,0)
time.sleep(0.5)
time.sleep(5)
finally:
myShape.clear()
# minecraft stuff testing
if __name__ == "__main__":
#connect to minecraft
mc = minecraft.Minecraft.create()
#test MinecraftDrawing
#clear area
mc.setBlocks(-25, 0, -25, 25, 25, 25, block.AIR.id)
#create drawing object
mcDrawing = MinecraftDrawing(mc)
#line
mcDrawing.drawLine(0,0,-10,-10,10,-5,block.STONE.id)
#circle
mcDrawing.drawCircle(-15,15,-15,10,block.WOOD.id)
#sphere
mcDrawing.drawSphere(-15,15,-15,5,block.OBSIDIAN.id)
#face - solid triangle
faceVertices = []
faceVertices.append(minecraft.Vec3(0,0,0))
faceVertices.append(minecraft.Vec3(5,10,0))
faceVertices.append(minecraft.Vec3(10,0,0))
mcDrawing.drawFace(faceVertices, True, block.SNOW_BLOCK.id)
#face - wireframe square
faceVertices = []
faceVertices.append(minecraft.Vec3(0,0,5))
faceVertices.append(minecraft.Vec3(10,0,5))
faceVertices.append(minecraft.Vec3(10,10,5))
faceVertices.append(minecraft.Vec3(0,10,5))
mcDrawing.drawFace(faceVertices, False, block.DIAMOND_BLOCK.id)
#face - 5 sided shape
faceVertices = []
faceVertices.append(minecraft.Vec3(0,15,0))
faceVertices.append(minecraft.Vec3(5,15,5))
faceVertices.append(minecraft.Vec3(3,15,10))
faceVertices.append(minecraft.Vec3(-3,15,10))
faceVertices.append(minecraft.Vec3(-5,15,5))
mcDrawing.drawFace(faceVertices, True, block.GOLD_BLOCK.id)
#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()