diff --git a/src/graphics/ui/elements/InventoryView.cpp b/src/graphics/ui/elements/InventoryView.cpp index 9449ce3b0..61403cad0 100644 --- a/src/graphics/ui/elements/InventoryView.cpp +++ b/src/graphics/ui/elements/InventoryView.cpp @@ -1,7 +1,6 @@ #include "InventoryView.hpp" #include -#include #include #include "assets/Assets.hpp" @@ -369,8 +368,14 @@ void SlotView::performLeftClick(ItemStack& stack, ItemStack& grabbed) { } auto& indices = *content->getIndices(); if (!layout.itemSource && stack.accepts(grabbed) && layout.placing) { - action = InteractionAction::PUT; - stack.move(grabbed, indices); + auto& def = indices.items.require(stack.getItemId()); + if (stack.getCount() < def.stackSize) { + action = InteractionAction::PUT; + stack.move(grabbed, indices); + } else { + action = InteractionAction::TAKE; + std::swap(grabbed, stack); + } } else { actIfCannotPut(stack, grabbed, action); }