From a3c85b4a59f32cecc5abf3f38f817c94d54fa4fa Mon Sep 17 00:00:00 2001 From: yueh Date: Wed, 14 Dec 2016 11:25:49 +0100 Subject: [PATCH] Fixes #2699: Do not trust the stackSize in case of internal changes. An external inventory might change the stacksize of the slot we currently are extracting from. Thus we have to cache the initial stackSize for a later calculation of the extracted amount per slot. As other inventories might NOT change the stacksize after a modification, we can not use the stack reaching 0 as conditions to break. --- src/main/java/appeng/parts/misc/ItemHandlerAdapter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/appeng/parts/misc/ItemHandlerAdapter.java b/src/main/java/appeng/parts/misc/ItemHandlerAdapter.java index 1edc563ad..b5fe6115c 100644 --- a/src/main/java/appeng/parts/misc/ItemHandlerAdapter.java +++ b/src/main/java/appeng/parts/misc/ItemHandlerAdapter.java @@ -117,7 +117,8 @@ class ItemHandlerAdapter implements IMEInventory, IBaseMonitor // maxSize, even if we request more. So even if it returns a valid stack, it might have more stuff. @@ -149,7 +150,7 @@ class ItemHandlerAdapter implements IMEInventory, IBaseMonitor 0 ); - remainingSize -= stackInInventorySlot.stackSize - remainingCurrentSlot; + remainingSize -= stackSizeCurrentSlot - remainingCurrentSlot; // Done? if( remainingSize <= 0 )