right click item increment fix with stack

This commit is contained in:
MihailRis
2024-05-27 07:19:13 +03:00
parent e8a703f814
commit 030c9ca085
+2 -1
View File
@@ -253,11 +253,12 @@ void SlotView::clicked(gui::GUI* gui, mousecode button) {
stack.setCount(halfremain); stack.setCount(halfremain);
} }
} else { } else {
auto stackDef = content->getIndices()->getItemDef(stack.getItemId());
if (stack.isEmpty()) { if (stack.isEmpty()) {
stack.set(grabbed); stack.set(grabbed);
stack.setCount(1); stack.setCount(1);
grabbed.setCount(grabbed.getCount()-1); grabbed.setCount(grabbed.getCount()-1);
} else if (stack.accepts(grabbed)){ } else if (stack.accepts(grabbed) && stack.getCount() < stackDef->stackSize){
stack.setCount(stack.getCount()+1); stack.setCount(stack.getCount()+1);
grabbed.setCount(grabbed.getCount()-1); grabbed.setCount(grabbed.getCount()-1);
} }