summaryrefslogtreecommitdiffstats
path: root/src/UI/EnderChestWindow.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/UI/EnderChestWindow.h')
-rw-r--r--src/UI/EnderChestWindow.h20
1 files changed, 19 insertions, 1 deletions
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