diff --git a/src/main/kotlin/net/shadowfacts/phycon/block/terminal/AbstractTerminalBlockEntity.kt b/src/main/kotlin/net/shadowfacts/phycon/block/terminal/AbstractTerminalBlockEntity.kt index 870b30e..deee792 100644 --- a/src/main/kotlin/net/shadowfacts/phycon/block/terminal/AbstractTerminalBlockEntity.kt +++ b/src/main/kotlin/net/shadowfacts/phycon/block/terminal/AbstractTerminalBlockEntity.kt @@ -109,7 +109,15 @@ abstract class AbstractTerminalBlockEntity(type: BlockEntityType<*>): DeviceBloc } override fun doHandleItemStack(packet: ItemStackPacket): ItemStack { - val remaining = internalBuffer.insert(packet.stack, TerminalBufferInventory.Mode.FROM_NETWORK) + val mode = + if (packet.bounceCount > 0) { + // if this stack bounced from an inventory, that means we previously tried to send it to the network, so retry + TerminalBufferInventory.Mode.TO_NETWORK + } else { + TerminalBufferInventory.Mode.FROM_NETWORK + } + + val remaining = internalBuffer.insert(packet.stack, mode) // this happens outside the normal update loop because by receiving the item stack packet // we "know" how much the count in the source inventory has changed