xSmallDeadGuyx/StoreOnDespawn — pull request #1 by eric-wieser (2012-04-28 18:52:16+00:00)
Title: "Nearest" chests very badly implemented.

Untested, but you get the idea. Build a map of distances to inventories, then iterate it over it to place the items. Map may be sorted in the wrong direction.