-
Notifications
You must be signed in to change notification settings - Fork 0
/
globe.py
39 lines (35 loc) · 1.43 KB
/
globe.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
from mine import *
def globe(center, radius=40, spacing_degrees=10, block=block.STAINED_GLASS_YELLOW):
quality = int(radius * 2*pi * 2)
# longitude lines
longitude_degrees = 0
while longitude_degrees < 360:
theta = longitude_degrees * 2 * pi / 360
xmult = radius * cos(theta)
zmult = radius * sin(theta)
for i in range(quality):
phi = 2 * pi * i / quality
y = radius * sin(phi)
x = xmult * cos(phi)
z = zmult * cos(phi)
mc.setBlock(center[0]+x,center[1]+y,center[2]+z,block)
longitude_degrees += spacing_degrees
# latitude lines
latitude_degrees = -90
while latitude_degrees <= 90:
phi = latitude_degrees * 2 * pi / 360
y = radius * sin(phi)
r = radius * cos(phi)
for i in range(quality):
theta = 2 * pi * i / quality
x = r * cos(theta)
z = r * sin(theta)
mc.setBlock(center[0]+x,center[1]+y,center[2]+z,block)
latitude_degrees += spacing_degrees
if __name__ == "__main__":
from _mp_ds_config import *
mc = Minecraft(Connection(serveradress, serverport), name=playernameonserver)
center = mc.player.getPos()
radius = 40
globe((center.x,center.y+radius,center.z), radius-1, 360./(2*pi*2*radius), block.STAINED_GLASS_BLUE)
globe((center.x,center.y+radius,center.z), radius, 10, block.STAINED_GLASS_YELLOW)