This repository was archived by the owner on Apr 12, 2026. It is now read-only.
forked from Voxelers/mcthings
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscene_basic.py
More file actions
77 lines (57 loc) · 1.9 KB
/
Copy pathscene_basic.py
File metadata and controls
77 lines (57 loc) · 1.9 KB
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
#!/usr/bin/env python3
# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
# Author (©): Alvaro del Castillo
import sys
import mcpi.block
import mcpi.minecraft
from mcpi.vec3 import Vec3
from mcthings.bridge import Bridge
from mcthings.scene import Scene
from mcthings.house import House
from mcthings.river import River
from mcthings.schematic import Schematic
from mcthings.server import Server
BUILDER_NAME = "ElasticExplorer"
MC_SEVER_HOST = "localhost"
MC_SEVER_PORT = 4711
def main():
try:
server = Server(MC_SEVER_HOST, MC_SEVER_PORT)
server.mc.postToChat("Building a Scene with several Things")
pos = server.mc.entity.getTilePos(server.mc.getPlayerEntityId(BUILDER_NAME))
pos.x += 1
river_width = 10
house_to_river = 5
house_width = 5
house = House(pos)
house.mirror = True
house.width = house_width
house.build()
# Create a river between the houses
pos.x += house_to_river + 1
river = River(pos)
river.width = river_width
river.build()
# Create a bridge over the river
pos.x -= 1
bridge = Bridge(pos)
bridge.large = river_width + 2
bridge.block = mcpi.block.STONE
bridge.build()
pos.x = bridge.end_position.x + house_to_river
house = House(pos)
house.width = house_width
house.build()
# Let's persist the scene
Scene.save("scene_basic.mct")
# Save as Schematic
Scene.to_schematic("../schematics/scene_basic.schematic")
# Load the Schematic to test it
s = Schematic(Vec3(pos.x+20, pos.y, pos.z))
s.file_path = "../schematics/scene_basic.schematic"
s.build()
except mcpi.connection.RequestError:
print("Can't connect to Minecraft server " + MC_SEVER_HOST)
if __name__ == "__main__":
main()
sys.exit(0)