Fixed not being able to extract half a stack of items with max stack size 1 in Grid when using right click, fixes #1626

This commit is contained in:
raoulvdberge
2018-01-18 21:18:12 +01:00
parent b24e054721
commit 688231cfc8
3 changed files with 11 additions and 2 deletions

View File

@@ -58,7 +58,11 @@ public class ItemGridHandler implements IItemGridHandler {
if ((flags & EXTRACT_HALF) == EXTRACT_HALF && itemSize > 1) {
size = itemSize / 2;
if (size > maxItemSize / 2) {
// Rationale for this check:
// If we have 32 buckets, and we want to extract half, we expect/need to get 8 (max stack size 16 / 2).
// Without this check, we would get 16 (total stack size 32 / 2).
// Max item size also can't be 1. Otherwise, if we want to extract half of 8 lava buckets, we would get size 0 (1 / 2).
if (size > maxItemSize / 2 && maxItemSize != 1) {
size = maxItemSize / 2;
}
} else if (single) {

View File

@@ -58,7 +58,11 @@ public class ItemGridHandlerPortable implements IItemGridHandler {
if ((flags & EXTRACT_HALF) == EXTRACT_HALF && itemSize > 1) {
size = itemSize / 2;
if (size > maxItemSize / 2) {
// Rationale for this check:
// If we have 32 buckets, and we want to extract half, we expect/need to get 8 (max stack size 16 / 2).
// Without this check, we would get 16 (total stack size 32 / 2).
// Max item size also can't be 1. Otherwise, if we want to extract half of 8 lava buckets, we would get size 0 (1 / 2).
if (size > maxItemSize / 2 && maxItemSize != 1) {
size = maxItemSize / 2;
}
} else if (single) {