-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathexample.py
36 lines (30 loc) · 1.18 KB
/
example.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
import grpc
import minecraft_pb2_grpc
from minecraft_pb2 import *
channel = grpc.insecure_channel('localhost:5001')
client = minecraft_pb2_grpc.MinecraftServiceStub(channel)
client.fillCube(FillCubeRequest( # Clear a 20x10x20 working area
cube=Cube(
min=Point(x=-10, y=4, z=-10),
max=Point(x=10, y=14, z=10)
),
type=AIR
))
client.spawnBlocks(Blocks(blocks=[ # Spawn a flying machine
# Lower layer
Block(position=Point(x=1, y=5, z=1), type=PISTON, orientation=NORTH),
Block(position=Point(x=1, y=5, z=0), type=SLIME, orientation=NORTH),
Block(position=Point(x=1, y=5, z=-1), type=STICKY_PISTON, orientation=SOUTH),
Block(position=Point(x=1, y=5, z=-2), type=PISTON, orientation=NORTH),
Block(position=Point(x=1, y=5, z=-4), type=SLIME, orientation=NORTH),
# Upper layer
Block(position=Point(x=1, y=6, z=0), type=REDSTONE_BLOCK, orientation=NORTH),
Block(position=Point(x=1, y=6, z=-4), type=REDSTONE_BLOCK, orientation=NORTH),
# Activate
Block(position=Point(x=1, y=6, z=-1), type=QUARTZ_BLOCK, orientation=NORTH),
]))
blocks = client.readCube(Cube(
min=Point(x=1, y=5, z=-4),
max=Point(x=1, y=6, z=1)
))
# print(blocks)