-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathminecraftlight.py
143 lines (108 loc) · 3.51 KB
/
minecraftlight.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
# While Minecraft: Pi Edition is running, run this file on a Raspberry Pi with this command:
# python minecrafthack.sh
# import the modules
from mcpi import block
from mcpi import minecraft
import RPi.GPIO as GPIO
import time
# First make a connection between python and the game
mc = minecraft.Minecraft.create()
# set up GPIO7 as an output
led = 7
GPIO.setmode(GPIO.BCM)
GPIO.setup(led, GPIO.OUT)
# mc is a object we can call to control the world. Let's say, "Hello!"
mc.postToChat("MrMike spells MIKE and lights up a light!")
# Turn GPIO7 on
GPIO.output(led, 1)
# Delay for 1 second, keeping the light on briefly
time.sleep(1)
# Turn GPIO7 off
GPIO.output(led, 0)
# delay for 1 second, keeping the light off briefly
time.sleep(1)
# You could read the coordinates in the top left, and choose numbers near those.
# Try to spell a word in the sky. It is very easy with copy and paste. I will write my name in the sky.
# M
mc.setBlock(5, 14, 5, block.GOLD_BLOCK)
mc.setBlock(5, 13, 5, block.GOLD_BLOCK)
mc.setBlock(5, 12, 5, block.GOLD_BLOCK)
mc.setBlock(5, 11, 5, block.GOLD_BLOCK)
mc.setBlock(5, 10, 5, block.GOLD_BLOCK)
mc.setBlock(5, 13, 6, block.GOLD_BLOCK)
mc.setBlock(5, 12, 7, block.GOLD_BLOCK)
mc.setBlock(5, 13, 8, block.GOLD_BLOCK)
mc.setBlock(5, 14, 9, block.GOLD_BLOCK)
mc.setBlock(5, 13, 9, block.GOLD_BLOCK)
mc.setBlock(5, 12, 9, block.GOLD_BLOCK)
mc.setBlock(5, 11, 9, block.GOLD_BLOCK)
mc.setBlock(5, 10, 9, block.GOLD_BLOCK)
# I spelled the letter M. Try to write your name and impress your friends!
# Turn GPIO7 on
GPIO.output(led, 1)
# Delay for 1 second, keeping the light on briefly
time.sleep(1)
# Turn GPIO7 off
GPIO.output(led, 0)
# delay for 1 second, keeping the light off briefly
time.sleep(1)
# I
mc.setBlock(5, 10, 11, block.GOLD_BLOCK)
mc.setBlock(5, 11, 11, block.GOLD_BLOCK)
mc.setBlock(5, 12, 11, block.GOLD_BLOCK)
mc.setBlock(5, 13, 11, block.GOLD_BLOCK)
mc.setBlock(5, 14, 11, block.GOLD_BLOCK)
# Turn GPIO7 on
GPIO.output(led, 1)
# Delay for 1 second, keeping the light on briefly
time.sleep(1)
# Turn GPIO7 off
GPIO.output(led, 0)
# delay for 1 second, keeping the light off briefly
time.sleep(1)
# K
mc.setBlock(5, 14, 13, block.GOLD_BLOCK)
mc.setBlock(5, 13, 13, block.GOLD_BLOCK)
mc.setBlock(5, 12, 13, block.GOLD_BLOCK)
mc.setBlock(5, 11, 13, block.GOLD_BLOCK)
mc.setBlock(5, 10, 13, block.GOLD_BLOCK)
mc.setBlock(5, 12, 14, block.GOLD_BLOCK)
mc.setBlock(5, 11, 15, block.GOLD_BLOCK)
mc.setBlock(5, 13, 15, block.GOLD_BLOCK)
mc.setBlock(5, 10, 16, block.GOLD_BLOCK)
mc.setBlock(5, 14, 16, block.GOLD_BLOCK)
# Turn GPIO7 on
GPIO.output(led, 1)
# Delay for 1 second, keeping the light on briefly
time.sleep(1)
# Turn GPIO7 off
GPIO.output(led, 0)
# delay for 1 second, keeping the light off briefly
time.sleep(1)
# E
mc.setBlock(5, 14, 18, block.GOLD_BLOCK)
mc.setBlock(5, 13, 18, block.GOLD_BLOCK)
mc.setBlock(5, 12, 18, block.GOLD_BLOCK)
mc.setBlock(5, 11, 18, block.GOLD_BLOCK)
mc.setBlock(5, 10, 18, block.GOLD_BLOCK)
mc.setBlock(5, 10, 19, block.GOLD_BLOCK)
mc.setBlock(5, 14, 19, block.GOLD_BLOCK)
mc.setBlock(5, 12, 19, block.GOLD_BLOCK)
mc.setBlock(5, 10, 20, block.GOLD_BLOCK)
mc.setBlock(5, 14, 20, block.GOLD_BLOCK)
# Turn GPIO7 on
GPIO.output(led, 1)
# Delay for 1 second, keeping the light on briefly
time.sleep(1)
# Turn GPIO7 off
GPIO.output(led, 0)
# delay for 1 second, keeping the light off briefly
time.sleep(1)
# Water
mc.setBlock(5, 10, 23, block.WATER)
# Turn GPIO7 on
GPIO.output(led, 1)
# Delay for 1 second, keeping the light on briefly
time.sleep(1)
# Turn GPIO7 off
GPIO.output(led, 0)