マインクラフト×python 自動車

from mcpi.minecraft import Minecraft
import time
import sys
mc = Minecraft.create()
pos=mc.player.getTilePos()

"""
座標と方角
        (西)x---->(東)
 (北)
  z
  ↓
  ↓
 (南)

スライムブロック(165)

オブザーバー(218)
0	下向き
1	上向き
2	南向き
3	北向き
4	東向き
5	西向き

ピストン(33)、吸着ピストン(29)
0	下
1	上
2	北
3	南
4	西
5	東

"""
BlockArray=[
[
    ["165 0","218 2","000 0","000 0","000 0"],
    ["165 0","033 5","218 2","165 0","000 0"],
    ["165 0","165 0","029 4","165 0","000 0"],
    ["000 0","000 0","000 0","000 0","000 0"],
    ["000 0","000 0","000 0","000 0","000 0"],
],
[
    ["001 0","000 0","000 0","000 0","000 0"],
    ["001 0","000 0","000 0","000 0","000 0"],
    ["001 0","000 0","000 0","000 0","000 0"],
    ["000 0","000 0","000 0","000 0","000 0"],
    ["000 0","000 0","000 0","000 0","000 0"],
]
]

R=5
H=2
for y in range(H):
    for z in range(R):
        for x in range(R):
            B=BlockArray[y][z][x].split()
            if int(B[0])!=0:
                mc.setBlock(pos.x+x,pos.y+y,pos.z+z,int(B[0]),int(B[1]))
time.sleep(0.5)
mc.setBlock(pos.x+3,pos.y+0,pos.z+0,1)

コメント

タイトルとURLをコピーしました