A while ago I modified the Undead Players Module to collect
your Items. Pepole said to: Separate it, get rid of the hopper, don't delete ground and make it an item players have to keep on them. So I did that:After instaling this module, everytime you die with chest or trapped chest in your inventory and block of air above your head, a grave will be created. Grave is made up from chest (or trapped chest) and unbreakeable hopper. It will collect any Items in 10 block radius and after 1800 ticks (90sec. Chest can have 1728 items, but just to be sure.) the hopper will be destroyed leaving only chest renamed "Grave".
Q: Why don't you just use keepInventory true?
A: keepInventory will also save your XP and you will not drop armor and sword, which s big part of Undead Players Module
Credit: TheAl_T, Planet Minecraft