Skip to content

Commit 526f752

Browse files
committed
Fix #1657 and Fix #1662
1 parent 56d8567 commit 526f752

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/main/java/com/simibubi/create/content/processing/basin/BasinBlockEntity.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -452,25 +452,24 @@ private void tryClearingSpoutputOverflow() {
452452
continue;
453453
}
454454

455-
if (targetInv == null)
456-
break;
457-
458-
long inserted = TransferUtil.insertItem(targetInv, itemStack);
459-
if (inserted == 0)
460-
continue;
461-
if (filter != null && !filter.test(itemStack))
462-
continue;
455+
if (targetInv == null)
456+
break;
463457

464-
if (visualizedOutputItems.size() < 3)
465-
visualizedOutputItems.add(LongAttached.withZero(itemStack));
466-
update = true;
458+
try (Transaction nested = t.openNested()) {
459+
long inserted = targetInv.insert(ItemVariant.of(itemStack), itemStack.getCount(), nested);
460+
if (itemStack.getCount() != inserted)
461+
continue;
462+
if (filter != null && !filter.test(itemStack))
463+
continue;
464+
465+
if (visualizedOutputItems.size() < 3)
466+
visualizedOutputItems.add(LongAttached.withZero(itemStack));
467+
update = true;
467468

468-
inserted = TransferUtil.insertItem(targetInv, itemStack.copy());
469-
if (inserted == itemStack.getCount())
470-
iterator.remove();
471-
else
472-
itemStack.setCount((int) inserted);
473-
}
469+
iterator.remove();
470+
nested.commit();
471+
}
472+
}
474473

475474
for (Iterator<FluidStack> iterator = spoutputFluidBuffer.iterator(); iterator.hasNext();) {
476475
FluidStack fluidStack = iterator.next();

0 commit comments

Comments
 (0)