mirror of
https://github.com/luanti-org/luanti.git
synced 2025-12-06 07:25:26 +01:00
Add wear bar color API (#13328)
--------- Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com> Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> Co-authored-by: grorp <gregor.parzefall@posteo.de>
This commit is contained in:
@@ -131,6 +131,15 @@ struct ItemStack
|
||||
return metadata.getToolCapabilities(*item_cap); // Check for override
|
||||
}
|
||||
|
||||
const std::optional<WearBarParams> &getWearBarParams(
|
||||
const IItemDefManager *itemdef) const
|
||||
{
|
||||
auto &meta_override = metadata.getWearBarParamOverride();
|
||||
if (meta_override.has_value())
|
||||
return meta_override;
|
||||
return itemdef->get(name).wear_bar_params;
|
||||
}
|
||||
|
||||
// Wear out (only tools)
|
||||
// Returns true if the item is (was) a tool
|
||||
bool addWear(s32 amount, const IItemDefManager *itemdef)
|
||||
|
||||
Reference in New Issue
Block a user