Fixed the problem with the storage system item count increasing when voiding stuff.
This commit is contained in:
@@ -521,14 +521,25 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
((ItemStorageExternal) storage).updateCacheForcefully();
|
||||
}
|
||||
|
||||
if (remainder == null) {
|
||||
if (remainder == null || remainder.stackSize < 0) {
|
||||
break;
|
||||
} else {
|
||||
size = remainder.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
int inserted = remainder != null ? (orginalSize - remainder.stackSize) : orginalSize;
|
||||
//If the stack size of the remainder is negative, it means of the original size abs(remainder.stackSize) items have been voided
|
||||
int inserted;
|
||||
if(remainder == null) {
|
||||
inserted = orginalSize;
|
||||
}
|
||||
else if(remainder.stackSize < 0) {
|
||||
inserted = orginalSize + remainder.stackSize;
|
||||
remainder = null;
|
||||
}
|
||||
else {
|
||||
inserted = orginalSize - remainder.stackSize;
|
||||
}
|
||||
|
||||
if (!simulate && inserted > 0) {
|
||||
itemStorage.add(ItemHandlerHelper.copyStackWithSize(stack, inserted), false);
|
||||
|
||||
@@ -53,9 +53,9 @@ public class TileStorage extends TileNode implements IItemStorageProvider, IStor
|
||||
|
||||
ItemStack result = super.insertItem(stack, size, simulate);
|
||||
|
||||
if(voidExcess) {
|
||||
if(voidExcess && result != null) {
|
||||
//Simulate should not matter as the items are voided anyway
|
||||
return null;
|
||||
result.stackSize = -result.stackSize;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user