Inventory: Show item Damage (#1213)

* /inventory add show item Damage
* Removing unnecessary using
* Upgrade
* Fix
* Update Inventory.cs
* add Damage
* Done
* Done, Fix
* Remove extra space, Fix documentation
This commit is contained in:
Рома Данилов 2020-08-17 15:27:15 +05:00 committed by GitHub
parent 08db87e5f6
commit 33781c5de5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 4 deletions

View file

@ -70,5 +70,24 @@ namespace MinecraftClient.Inventory
return null;
}
}
/// <summary>
/// Retrieve item damage from NBT properties. Returns 0 if no damage is defined.
/// </summary>
public int Damage
{
get
{
if (NBT != null && NBT.ContainsKey("Damage"))
{
object damage = NBT["Damage"];
if (damage != null)
{
return int.Parse(damage.ToString());
}
}
return 0;
}
}
}
}