forked from juedwards/MinecraftEducationPythonExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parkour.py
74 lines (64 loc) · 1.91 KB
/
parkour.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
gameplay.set_game_mode(CREATIVE, mobs.target(NEAREST_PLAYER))
gameplay.set_weather(CLEAR)
def on_build():
player.say("Building Course.")
lava_pit_size = 10
counterX = 0
counterZ = 0
agent.set_item(LAVA_BUCKET, 1, 1)
agent.set_slot(1)
agent.teleport_to_player()
start_pos = agent.get_position()
agent.teleport(start_pos, WEST)
while counterX < lava_pit_size:
while counterZ < lava_pit_size:
agent.move(FORWARD, 1)
agent.destroy(DOWN)
agent.place(DOWN)
counterZ +=1
counterZ = 0
if counterX % 2 == 0:
agent.move(FORWARD, 1)
agent.turn_left()
agent.move(FORWARD, 1)
agent.turn_left()
else:
agent.move(FORWARD,1)
agent.turn_right()
agent.move(FORWARD, 1)
agent.turn_right()
counterX +=1
counterX = 0
agent.teleport(start_pos, WEST)
post_size = 1
agent.set_slot(2)
agent.set_item(GRASS, 64, 2)
spaceZ = Math.random()* lava_pit_size
if spaceZ > 10: spaceZ = 10
while counterX < lava_pit_size:
while counterZ < spaceZ:
agent.move(FORWARD, 1)
counterZ +=1
agent.move(UP, 1)
agent.place(DOWN)
counterZ +=1
agent.move(FORWARD, 1)
agent.move(DOWN, 1)
while counterZ < lava_pit_size:
agent.move(FORWARD, 1)
counterZ+=1
counterZ = 0
spaceZ = Math.random()* lava_pit_size
if spaceZ > 10: spaceZ = 10
if counterX % 2 == 0:
agent.move(FORWARD, 1)
agent.turn_left()
agent.move(FORWARD, 1)
agent.turn_left()
else:
agent.move(FORWARD,1)
agent.turn_right()
agent.move(FORWARD, 1)
agent.turn_right()
counterX += 1
player.on_chat("Build", on_build)