mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 23:11:49 +00:00
fix p.5
This commit is contained in:
parent
2c9cb8b3d4
commit
5d66c41f80
1 changed files with 13 additions and 4 deletions
|
|
@ -366,10 +366,10 @@ void SlotView::performLeftClick(ItemStack& stack, ItemStack& grabbed) {
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
auto indices = *content->getIndices();
|
||||||
if (!layout.itemSource && stack.accepts(grabbed) && layout.placing) {
|
if (!layout.itemSource && stack.accepts(grabbed) && layout.placing) {
|
||||||
action = InteractionAction::PUT;
|
action = InteractionAction::PUT;
|
||||||
stack.move(grabbed, *content->getIndices());
|
stack.move(grabbed, indices);
|
||||||
} else {
|
} else {
|
||||||
if (layout.itemSource) {
|
if (layout.itemSource) {
|
||||||
if (grabbed.isEmpty()) {
|
if (grabbed.isEmpty()) {
|
||||||
|
|
@ -379,8 +379,17 @@ void SlotView::performLeftClick(ItemStack& stack, ItemStack& grabbed) {
|
||||||
grabbed.maximizeCount(*content->getIndices());
|
grabbed.maximizeCount(*content->getIndices());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
action = InteractionAction::PUT;
|
// TODO: refactor to reduce nesting
|
||||||
grabbed.clear();
|
if (grabbed.accepts(stack)) {
|
||||||
|
auto& def = indices.items.require(stack.getItemId());
|
||||||
|
if (grabbed.getCount() < def.stackSize) {
|
||||||
|
action = InteractionAction::TAKE;
|
||||||
|
grabbed.setCount(grabbed.getCount() + 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
action = InteractionAction::PUT;
|
||||||
|
grabbed.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (grabbed.isEmpty()) {
|
} else if (grabbed.isEmpty()) {
|
||||||
if (layout.taking) {
|
if (layout.taking) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue