From 8591935a4b48c24a16e8c103d474ee6803ce56a0 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 13 Dec 2014 18:49:11 +0100 Subject: Implemented vanilla-like shift click. This fixes many visual bugs. --- src/UI/EnderChestWindow.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/UI/EnderChestWindow.h') diff --git a/src/UI/EnderChestWindow.h b/src/UI/EnderChestWindow.h index 597fab9f9..4c7dd2495 100644 --- a/src/UI/EnderChestWindow.h +++ b/src/UI/EnderChestWindow.h @@ -29,7 +29,6 @@ public: m_BlockY(a_EnderChest->GetPosY()), m_BlockZ(a_EnderChest->GetPosZ()) { - m_ShouldDistributeToHotbarFirst = false; m_SlotAreas.push_back(new cSlotAreaEnderChest(a_EnderChest, *this)); m_SlotAreas.push_back(new cSlotAreaInventory(*this)); m_SlotAreas.push_back(new cSlotAreaHotBar(*this)); @@ -50,6 +49,25 @@ public: m_World->BroadcastSoundEffect("random.chestclosed", (double)m_BlockX, (double)m_BlockY, (double)m_BlockZ, 1, 1); } + virtual void DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply) override + { + cSlotAreas AreasInOrder; + + if (a_ClickedArea == m_SlotAreas[0]) + { + // Chest Area + AreasInOrder.push_back(m_SlotAreas[2]); /* Hotbar */ + AreasInOrder.push_back(m_SlotAreas[1]); /* Inventory */ + super::DistributeStack(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, true); + } + else + { + // Hotbar or Inventory + AreasInOrder.push_back(m_SlotAreas[0]); /* Chest */ + super::DistributeStack(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, false); + } + } + protected: cWorld * m_World; int m_BlockX, m_BlockY, m_BlockZ; // Position of the enderchest, for the window-close packet -- cgit v1.2.3