fixed a crafting terminal overflow if the crafting slots are full

This commit is contained in:
Ell 2020-10-20 18:31:13 +02:00
parent c1100b02fe
commit a53e0cf5d5

View file

@ -177,7 +177,10 @@ public class CraftingTerminalTileEntity extends ItemTerminalTileEntity {
if (lowestSlot >= 0) { if (lowestSlot >= 0) {
ItemStack copy = remain.copy(); ItemStack copy = remain.copy();
copy.setCount(1); copy.setCount(1);
remain.shrink(1 - tile.craftItems.insertItem(lowestSlot, copy, simulate).getCount()); // if there were remaining items inserting into the slot with lowest contents, we're overflowing
if (tile.craftItems.insertItem(lowestSlot, copy, simulate).getCount() > 0)
break;
remain.shrink(1);
if (remain.isEmpty()) if (remain.isEmpty())
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }