Skip to content

Commit 562dfdd

Browse files
2to3
1 parent 1a84868 commit 562dfdd

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

api/python/mcpi/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import socket
22
import select
33
import sys
4-
from util import flatten_parameters_to_string
4+
from .util import flatten_parameters_to_string
55

66
""" @author: Aron Nieminen, Mojang AB"""
77

api/python/mcpi/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from vec3 import Vec3
1+
from .vec3 import Vec3
22

33
class BlockEvent:
44
"""An Event related to blocks (e.g. placed, removed, hit)"""

api/python/mcpi/minecraft.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
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
55
import 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

111111
class 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"""

api/python/mcpi/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
def flatten(l):
44
for e in l:
5-
if isinstance(e, collections.Iterable) and not isinstance(e, basestring):
5+
if isinstance(e, collections.Iterable) and not isinstance(e, str):
66
for ee in flatten(e): yield ee
77
else: yield e
88

0 commit comments

Comments
 (0)