mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Add ItemStack:get_description() to get tooltip (#8847)
This commit is contained in:
@@ -246,6 +246,14 @@ std::string ItemStack::getItemString() const
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string ItemStack::getDescription(IItemDefManager *itemdef) const
|
||||
{
|
||||
std::string desc = metadata.getString("description");
|
||||
if (desc.empty())
|
||||
desc = getDefinition(itemdef).description;
|
||||
return desc.empty() ? name : desc;
|
||||
}
|
||||
|
||||
|
||||
ItemStack ItemStack::addItem(ItemStack newitem, IItemDefManager *itemdef)
|
||||
{
|
||||
|
Reference in New Issue
Block a user