Prevent overflowing of item stacks in lists, #490
This commit is contained in:
@@ -20,7 +20,11 @@ public class ItemStackList implements IItemStackList {
|
||||
public void add(ItemStack stack) {
|
||||
for (ItemStack otherStack : stacks.get(stack.getItem())) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(otherStack, stack)) {
|
||||
if ((long) otherStack.stackSize + (long) stack.stackSize > Integer.MAX_VALUE) {
|
||||
otherStack.stackSize = Integer.MAX_VALUE;
|
||||
} else {
|
||||
otherStack.stackSize += stack.stackSize;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user