Item sorter

The item sorter is a machine which sorts items by type in inventories (such as chests or crates) connected to it through item cables. Upon receiving a redstone impulse, it removes all stacks from all inventories connected to it, then placed them back in order. It also merges items of the same type into the largest possible stack(s), to ensure that as little space as possible is used.