diff --git a/game.py b/game.py index 14844ed..f1775ba 100644 --- a/game.py +++ b/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: