Skip to content

Commit

Permalink
2to3
Browse files Browse the repository at this point in the history
  • Loading branch information
doismellburning committed Sep 21, 2014
1 parent 1a84868 commit 562dfdd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion api/python/mcpi/connection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import socket
import select
import sys
from util import flatten_parameters_to_string
from .util import flatten_parameters_to_string

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

Expand Down
2 changes: 1 addition & 1 deletion api/python/mcpi/event.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from vec3 import Vec3
from .vec3 import Vec3

class BlockEvent:
"""An Event related to blocks (e.g. placed, removed, hit)"""
Expand Down
20 changes: 10 additions & 10 deletions api/python/mcpi/minecraft.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from connection import Connection
from vec3 import Vec3
from event import BlockEvent
from block import Block
from .connection import Connection
from .vec3 import Vec3
from .event import BlockEvent
from .block import Block
import math
from util import flatten
from .util import flatten

""" Minecraft PI low level api v0.1_1
Expand All @@ -30,7 +30,7 @@ def __init__(self, connection, packagePrefix):
def getPos(self, id):
"""Get entity position (entityId:int) => Vec3"""
s = self.conn.sendReceive(self.pkg + ".getPos", id)
return Vec3(*map(float, s.split(",")))
return Vec3(*list(map(float, s.split(","))))

def setPos(self, id, *args):
"""Set entity position (entityId:int, x,y,z)"""
Expand All @@ -39,7 +39,7 @@ def setPos(self, id, *args):
def getTilePos(self, id):
"""Get entity tile position (entityId:int) => Vec3"""
s = self.conn.sendReceive(self.pkg + ".getTile", id)
return Vec3(*map(int, s.split(",")))
return Vec3(*list(map(int, s.split(","))))

def setTilePos(self, id, *args):
"""Set entity tile position (entityId:int) => Vec3"""
Expand Down Expand Up @@ -105,7 +105,7 @@ def pollBlockHits(self):
"""Only triggered by sword => [BlockEvent]"""
s = self.conn.sendReceive("events.block.hits")
events = [e for e in s.split("|") if e]
return [BlockEvent.Hit(*map(int, e.split(","))) for e in events]
return [BlockEvent.Hit(*list(map(int, e.split(",")))) for e in events]


class Minecraft:
Expand All @@ -125,7 +125,7 @@ def getBlock(self, *args):
def getBlockWithData(self, *args):
"""Get block with data (x,y,z) => Block"""
ans = self.conn.sendReceive("world.getBlockWithData", intFloor(args))
return Block(*map(int, ans.split(",")))
return Block(*list(map(int, ans.split(","))))
"""
@TODO
"""
Expand All @@ -148,7 +148,7 @@ def getHeight(self, *args):
def getPlayerEntityIds(self):
"""Get the entity ids of the connected players => [id:int]"""
ids = self.conn.sendReceive("world.getPlayerIds")
return map(int, ids.split("|"))
return list(map(int, ids.split("|")))

def saveCheckpoint(self):
"""Save a checkpoint that can be used for restoring the world"""
Expand Down
2 changes: 1 addition & 1 deletion api/python/mcpi/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

def flatten(l):
for e in l:
if isinstance(e, collections.Iterable) and not isinstance(e, basestring):
if isinstance(e, collections.Iterable) and not isinstance(e, str):
for ee in flatten(e): yield ee
else: yield e

Expand Down

0 comments on commit 562dfdd

Please sign in to comment.