1
- from connection import Connection
2
- from vec3 import Vec3
3
- from event import BlockEvent
4
- from block import Block
1
+ from . connection import Connection
2
+ from . vec3 import Vec3
3
+ from . event import BlockEvent
4
+ from . block import Block
5
5
import math
6
- from util import flatten
6
+ from . util import flatten
7
7
8
8
""" Minecraft PI low level api v0.1_1
9
9
@@ -30,7 +30,7 @@ def __init__(self, connection, packagePrefix):
30
30
def getPos (self , id ):
31
31
"""Get entity position (entityId:int) => Vec3"""
32
32
s = self .conn .sendReceive (self .pkg + ".getPos" , id )
33
- return Vec3 (* map (float , s .split ("," )))
33
+ return Vec3 (* list ( map (float , s .split ("," ) )))
34
34
35
35
def setPos (self , id , * args ):
36
36
"""Set entity position (entityId:int, x,y,z)"""
@@ -39,7 +39,7 @@ def setPos(self, id, *args):
39
39
def getTilePos (self , id ):
40
40
"""Get entity tile position (entityId:int) => Vec3"""
41
41
s = self .conn .sendReceive (self .pkg + ".getTile" , id )
42
- return Vec3 (* map (int , s .split ("," )))
42
+ return Vec3 (* list ( map (int , s .split ("," ) )))
43
43
44
44
def setTilePos (self , id , * args ):
45
45
"""Set entity tile position (entityId:int) => Vec3"""
@@ -105,7 +105,7 @@ def pollBlockHits(self):
105
105
"""Only triggered by sword => [BlockEvent]"""
106
106
s = self .conn .sendReceive ("events.block.hits" )
107
107
events = [e for e in s .split ("|" ) if e ]
108
- return [BlockEvent .Hit (* map (int , e .split ("," ))) for e in events ]
108
+ return [BlockEvent .Hit (* list ( map (int , e .split ("," ) ))) for e in events ]
109
109
110
110
111
111
class Minecraft :
@@ -125,7 +125,7 @@ def getBlock(self, *args):
125
125
def getBlockWithData (self , * args ):
126
126
"""Get block with data (x,y,z) => Block"""
127
127
ans = self .conn .sendReceive ("world.getBlockWithData" , intFloor (args ))
128
- return Block (* map (int , ans .split ("," )))
128
+ return Block (* list ( map (int , ans .split ("," ) )))
129
129
"""
130
130
@TODO
131
131
"""
@@ -148,7 +148,7 @@ def getHeight(self, *args):
148
148
def getPlayerEntityIds (self ):
149
149
"""Get the entity ids of the connected players => [id:int]"""
150
150
ids = self .conn .sendReceive ("world.getPlayerIds" )
151
- return map (int , ids .split ("|" ))
151
+ return list ( map (int , ids .split ("|" ) ))
152
152
153
153
def saveCheckpoint (self ):
154
154
"""Save a checkpoint that can be used for restoring the world"""
0 commit comments