Minecraft wiki entry for Item_(entity), associated text: When two stackable items of the same type come within 3/4 of a block of each other, they merge into a single stack if the resulting stack size does not exceed that item's maximum stack size.