19. ソースコード
• サンプルに
手を入れた
• 程度
import
os
from
mcpi
import
minecra*
mc
=
minecra*.Minecra*.create()
try:
while
True:
#Get
the
block
hit
events
blockHits
=
mc.events.pollBlockHits()
#
if
a
block
has
been
hit
if
blockHits:
#
for
each
block
that
has
been
hit
for
blockHit
in
blockHits:
#
do
something
with
the
block
px
=
blockHit.pos.x
py
=
blockHit.pos.y
pz
=
blockHit.pos.z
if
px
==
80
and
py
==
8
and
pz
==
-‐29
:
mc.postToChat("UIIIN")
os.system('eject
-‐T
/dev/sr0')
except
KeyboardInterrupt:
print("nnStopped.n")
exit()