Keep named items after death
We all have lost that enchanted armour set or a efficiency v pickaxe in lava once. It's painful to see that item that consumed so many resources to craft be destroyed by lava.
I was thinking about a set of command blocks that will retrieve any NAMED ITEM from your inventory once you die, and return it to your inventory upon respawning. Any other items will be dropped to the ground, waiting for you to pick them back or be destroyed by lava.
Is it possible to create such a mechanism?
If possible, I'd love to see that the recovered items would suffer a 20% durability loss, in order to discourage the user from not caring about death.
I am familiar with the /gamerule keepInventory true command, but I find it highly overpowered, and which makes death a mere nuisance rather than something to be feared.
No mods... this is a vanilla server.
Best Answer
There is a way you can kind of do it but the name has to be that same you can't just have a random name, what you can do is a /testfor command and if it comes out false you give them a tool and the command you would use would be like.
/testfor @a {Inventory:[{id:"minecraft:diamond_pickaxe",tag:{display:{Name:"The Digger"}}}]}
But you would replace minecraft:diamond_pickaxe with the item and The Digger with the name but like I said the name has to be pre-made but you won't be able to detect the durability of it but you could give them a half damaged tool or something instead of a full one by using if it was a diamond pickaxe
/give [player] minecraft:diamond_pickaxe 1 781 {display:{Name:"The Digger"}}
But the is no way to detect the damage previously on the tool
Pictures about "Keep named items after death"



How do you keep your inventory in Minecraft after you die?
How to Enter the CommandHow do you keep your items when you die?
Type \u201c/gamerule keepInventory true\u201d in the chatbox. Press \u201cEnter.\u201d After you die, you'll still have all your tools.How do I keep inventory true?
Head over to your server Console or enter into your Minecraft Server. Enter the command /gamerule keepInventory true (ensuring to keep the upper case letters). This'll allow players to keep their items upon death.How to Keep Specific Items After Death
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Mostafa.ft shots, Mitja Juraja, Kat Smith, Renato Danyi
