Select most damaged tool
This commit is contained in:
parent
743d002167
commit
4b97aaf739
2
game.py
2
game.py
|
@ -893,7 +893,9 @@ class Game:
|
|||
def select_item(self, items):
|
||||
# select the first match from items of inv
|
||||
# uses smallest stack of that match
|
||||
# and optionally the most damaged item
|
||||
inv_items = list(self.g.inv.items())
|
||||
inv_items.sort(key=lambda x: (x[1].nbt or {}).get('Damage', 0), reverse=True)
|
||||
inv_items.sort(key=lambda x: x[1].item_count or 0)
|
||||
for slot, item in inv_items:
|
||||
if item.item_id in items:
|
||||
|
|
Loading…
Reference in New Issue
Block a user