From cdc452916e3ec7e61f4a1ad822666192593b4b08 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Thu, 2 Apr 2020 12:42:15 +0000 Subject: 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 --- src/ClientHandle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index ef121cf12..9a92a3005 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1211,9 +1211,9 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB cItem EquippedItem = m_Player->GetEquippedItem(); cItem OffhandItem = m_Player->GetOffHandEquipedItem(); - cInventory & Intentory = m_Player->GetInventory(); - Intentory.SetShieldSlot(EquippedItem); - Intentory.SetHotbarSlot(Intentory.GetEquippedSlotNum(), OffhandItem); + cInventory & Inventory = m_Player->GetInventory(); + Inventory.SetShieldSlot(EquippedItem); + Inventory.SetEquippedItem(OffhandItem); return; } -- cgit v1.2.3