mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-24 13:25:21 +02:00
Wieldhand: Specify which ItemStack to use (#8961)
Makes 'get_wield_item' to return the "main" ItemStack
This commit is contained in:
@@ -68,25 +68,16 @@ float ServerActiveObject::getMinimumSavedMovement()
|
||||
return 2.0*BS;
|
||||
}
|
||||
|
||||
ItemStack ServerActiveObject::getWieldedItem() const
|
||||
ItemStack ServerActiveObject::getWieldedItem(ItemStack *selected, ItemStack *hand) const
|
||||
{
|
||||
const Inventory *inv = getInventory();
|
||||
if(inv)
|
||||
{
|
||||
const InventoryList *list = inv->getList(getWieldList());
|
||||
if(list && (getWieldIndex() < (s32)list->getSize()))
|
||||
return list->getItem(getWieldIndex());
|
||||
}
|
||||
*selected = ItemStack();
|
||||
if (hand)
|
||||
*hand = ItemStack();
|
||||
|
||||
return ItemStack();
|
||||
}
|
||||
|
||||
bool ServerActiveObject::setWieldedItem(const ItemStack &item)
|
||||
{
|
||||
if(Inventory *inv = getInventory()) {
|
||||
if (InventoryList *list = inv->getList(getWieldList())) {
|
||||
list->changeItem(getWieldIndex(), item);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user