Inventory handling improvements

Fix click issue for item with NBT
Show custom display names in inventory
See issues #910 #912 #914
This commit is contained in:
ORelio 2020-04-01 22:05:44 +02:00
parent b01c50b792
commit dbe02c063c
4 changed files with 51 additions and 9 deletions

View file

@ -37,7 +37,12 @@ namespace MinecraftClient.Commands
List<string> response = new List<string>();
response.Add("Inventory #" + inventoryId + " - " + inventory.Title + "§8");
foreach (KeyValuePair<int, Item> item in inventory.Items)
response.Add(String.Format(" #{0}: {1} x{2}", item.Key, item.Value.Type, item.Value.Count));
{
string displayName = item.Value.DisplayName;
if (String.IsNullOrEmpty(displayName))
response.Add(String.Format(" #{0}: {1} x{2}", item.Key, item.Value.Type, item.Value.Count));
else response.Add(String.Format(" #{0}: {1} x{2} - {3}§8", item.Key, item.Value.Type, item.Value.Count, displayName));
}
return String.Join("\n", response.ToArray());
case "click":
if (args.Length == 3)