This commit is contained in:
əlemi 2021-12-17 14:24:44 +01:00
parent 8bef9327fe
commit 9c61b297d3

View file

@ -63,12 +63,12 @@ def format_item(item:dict, compact=False, nbt:bool=False) -> str:
if not item: if not item:
return "[ ]" return "[ ]"
item_id = f"{item['id']:03d}" item_id = f"{item['id']:03d}"
item_count = f"x{item['count']}" if 'count' in item else '' item_count = f"{item['count']}x" if 'count' in item else ''
item_damage = f"|{item['damage']:03d}" if 'damage' in item else '' item_damage = f"|{item['damage']:03d}" if 'damage' in item else ''
item_nbt = item['nbt'].pretty() if 'nbt' in item else '' item_nbt = item['nbt'].pretty() if 'nbt' in item else ''
if compact: if compact:
return f"[{item_id:03d}]" return f"[{item_id:03d}]"
if nbt: if nbt:
return f"[{item_id}{item_count}{item_damage}]({item_nbt})" return f"[{item_count}{item_id}{item_damage}]({item_nbt})"
return f"[{item_id}{item_count}{item_damage}]" return f"[{item_count}{item_id}{item_damage}]"