1
0

Replace buckets to the selected hotbar slot, rather than the first available. (#4580)

* Replace buckets to the selected hotbar slot, rather than the first available.

Replicates vanilla behaviour, as well as being more logical.

* Refactor cInventory::AddItem. Behaviour is now documented

* Add new cInventory::ReplaceOneEquippedItem and ::SetEquippedItem methods

* Return empty potion to the same slot after drinking

* Replace buckets correctly in other situations, not simply water and lava

Uses the new ReplaceOneEquippedItem method

* Correct collecting water from source block with bottle

* Add cPlayer::ReplaceOneEquippedItemTossRest method

* Handle stacked filled buckets (in theory)

Use new cPlayer::ReplaceOneEquippedItemTossRest method
This commit is contained in:
Alexander Harkness
2020-04-02 12:42:15 +00:00
committed by GitHub
parent d5c58c6b17
commit cdc452916e
13 changed files with 228 additions and 80 deletions

View File

@@ -44,10 +44,10 @@ void cCow::OnRightClicked(cPlayer & a_Player)
short HeldItem = a_Player.GetEquippedItem().m_ItemType;
if (HeldItem == E_ITEM_BUCKET)
{
// Milk the cow.
if (!a_Player.IsGameModeCreative())
{
a_Player.GetInventory().RemoveOneEquippedItem();
a_Player.GetInventory().AddItem(cItem(E_ITEM_MILK));
a_Player.ReplaceOneEquippedItemTossRest(cItem(E_ITEM_MILK));
}
}
}