Skip to content

Commit

Permalink
Resolved math.floor() from issue traverseda#45 and fixed inventory bu…
Browse files Browse the repository at this point in the history
…g from PR traverseda#44
  • Loading branch information
koubio committed Apr 20, 2016
1 parent b5a39bc commit 39f4d13
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pycraft/objects/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def adjust_inventory(self, item, qty=1):
self.inventory.remove(item)
del self.items[item]
if self.block == item:
self.block = self.inventory if len(self.inventory) else None
self.block = self.inventory[0] if len(self.inventory) else None

This comment has been minimized.

Copy link
@Eijebong

Eijebong Apr 21, 2016

You could simplify to self.inventory[0] if self.inventory else None


def get_sight_vector(self):
"""Returns the current line of sight vector indicating the direction the
Expand Down
5 changes: 1 addition & 4 deletions pycraft/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

from math import floor

# Size of sectors used to ease block loading.
SECTOR_SIZE = 16

Expand Down Expand Up @@ -48,7 +45,7 @@ def normalize(position):
block_position : tuple of ints of len 3
"""
x, y, z = position
x, y, z = (int(floor(x)), int(floor(y)), int(floor(z)))
x, y, z = (int(round(x)), int(round(y)), int(round(z)))
return x, y, z


Expand Down

0 comments on commit 39f4d13

Please sign in to comment.