Fixed AssertionError when logging hopper transactions

This commit is contained in:
Intelli 2021-07-21 22:49:44 -06:00
parent 718d7d7a80
commit 3f0291e0d5

View File

@ -94,16 +94,15 @@ public final class HopperPushListener {
break; break;
} }
ItemStack itemStack = originalDestination[i]; ItemStack itemStack = (originalDestination[i] != null ? originalDestination[i].clone() : null);
if (itemStack != null && itemStack.isSimilar(movedItem)) { if (itemStack != null && itemStack.isSimilar(movedItem)) {
itemStack = itemStack.clone();
if (itemStack.getAmount() >= removeAmount) { if (itemStack.getAmount() >= removeAmount) {
itemStack.setAmount(itemStack.getAmount() - removeAmount); itemStack.setAmount(itemStack.getAmount() - removeAmount);
removeAmount = 0; removeAmount = 0;
} }
else { else {
removeAmount = removeAmount - itemStack.getAmount(); removeAmount = removeAmount - itemStack.getAmount();
itemStack.setAmount(0); itemStack = null;
} }
originalDestination[i] = itemStack; originalDestination[i] = itemStack;