mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
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:
parent
b01c50b792
commit
dbe02c063c
4 changed files with 51 additions and 9 deletions
|
|
@ -49,5 +49,26 @@ namespace MinecraftClient.Inventory
|
|||
return Type == ItemType.Air || Count == 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve item display name from NBT properties. NULL if no display name is defined.
|
||||
/// </summary>
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (NBT != null && NBT.ContainsKey("display"))
|
||||
{
|
||||
var displayProperties = NBT["display"] as Dictionary<string, object>;
|
||||
if (displayProperties != null && displayProperties.ContainsKey("Name"))
|
||||
{
|
||||
string displayName = displayProperties["Name"] as string;
|
||||
if (!String.IsNullOrEmpty(displayName))
|
||||
return MinecraftClient.Protocol.ChatParser.ParseText(displayProperties["Name"].ToString());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue