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
55import math
6- from util import flatten
6+ from . util import flatten
77
88""" Minecraft PI low level api v0.1_1
99
@@ -30,7 +30,7 @@ def __init__(self, connection, packagePrefix):
3030 def getPos (self , id ):
3131 """Get entity position (entityId:int) => Vec3"""
3232 s = self .conn .sendReceive (self .pkg + ".getPos" , id )
33- return Vec3 (* map (float , s .split ("," )))
33+ return Vec3 (* list ( map (float , s .split ("," ) )))
3434
3535 def setPos (self , id , * args ):
3636 """Set entity position (entityId:int, x,y,z)"""
@@ -39,7 +39,7 @@ def setPos(self, id, *args):
3939 def getTilePos (self , id ):
4040 """Get entity tile position (entityId:int) => Vec3"""
4141 s = self .conn .sendReceive (self .pkg + ".getTile" , id )
42- return Vec3 (* map (int , s .split ("," )))
42+ return Vec3 (* list ( map (int , s .split ("," ) )))
4343
4444 def setTilePos (self , id , * args ):
4545 """Set entity tile position (entityId:int) => Vec3"""
@@ -105,7 +105,7 @@ def pollBlockHits(self):
105105 """Only triggered by sword => [BlockEvent]"""
106106 s = self .conn .sendReceive ("events.block.hits" )
107107 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 ]
109109
110110
111111class Minecraft :
@@ -125,7 +125,7 @@ def getBlock(self, *args):
125125 def getBlockWithData (self , * args ):
126126 """Get block with data (x,y,z) => Block"""
127127 ans = self .conn .sendReceive ("world.getBlockWithData" , intFloor (args ))
128- return Block (* map (int , ans .split ("," )))
128+ return Block (* list ( map (int , ans .split ("," ) )))
129129 """
130130 @TODO
131131 """
@@ -148,7 +148,7 @@ def getHeight(self, *args):
148148 def getPlayerEntityIds (self ):
149149 """Get the entity ids of the connected players => [id:int]"""
150150 ids = self .conn .sendReceive ("world.getPlayerIds" )
151- return map (int , ids .split ("|" ))
151+ return list ( map (int , ids .split ("|" ) ))
152152
153153 def saveCheckpoint (self ):
154154 """Save a checkpoint that can be used for restoring the world"""
0 commit comments