fix stack increment (right click) with item data

This commit is contained in:
MihailRis 2025-02-18 03:23:45 +03:00
parent 6ef82982bd
commit 449b0ebca4

View File

@ -313,9 +313,14 @@ void SlotView::performRightClick(ItemStack& stack, ItemStack& grabbed) {
return;
}
if (stack.isEmpty()) {
stack.set(grabbed);
itemcount_t count = grabbed.getCount();
stack.set(std::move(grabbed));
stack.setCount(1);
grabbed.setCount(grabbed.getCount() - 1);
if (count == 1) {
grabbed = {};
} else {
grabbed = ItemStack(stack.getItemId(), count - 1);
}
} else if (stack.accepts(grabbed) && stack.getCount() < stackDef.stackSize) {
stack.setCount(stack.getCount() + 1);
grabbed.setCount(grabbed.getCount() - 1);