forked from martinohanlon/minecraft-starwars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trench.py
executable file
·58 lines (45 loc) · 1.71 KB
/
trench.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
from mcpi.minecraft import Minecraft
from mcpi.minecraft import Vec3
import mcpi.block as block
import mcpi.minecraftstuff as mcstuff
class Trench:
def __init__(self, pos, width, height, length):
self.mc = Minecraft.create()
self.pos = pos
self.width = width
self.height = height
self.length = length
self._draw()
def _draw(self):
pos = self.pos
mc = self.mc
width = self.width
height = self.height
length = self.length
#create trench
mc.setBlocks(pos.x, pos.y, pos.z,
pos.x + width, pos.y + height, pos.z + length,
block.WOOL.id, 15)
mc.setBlocks(pos.x + 1, pos.y + 1, pos.z + 1,
pos.x + width - 1, pos.y + height, pos.z + length - 1,
block.AIR.id)
#find the exhaust port position
self.exhaustPortPos = Vec3(pos.x + (width / 2),
pos.y + (height / 2),
pos.z + 1)
#draw exhaust post
mcDraw = mcstuff.MinecraftDrawing(self.mc)
mcDraw.drawCircle(self.exhaustPortPos.x,
self.exhaustPortPos.y,
self.exhaustPortPos.z,
2, block.IRON_BLOCK.id)
def clear(self):
pos = self.pos
mc = self.mc
width = self.width
height = self.height
length = self.length
#clear trench
mc.setBlocks(pos.x, pos.y, pos.z,
pos.x + width, pos.y + height, pos.z + length,
block.AIR.id)