# Is there a Minecraft command to retrieve a player inventory?

I'd like to create a Minecraft data pack to let a player see what he dropped/lost upon death (whatever he had in inventory+hotbar+offhand+armor+etc). I got the GUI part but i'm missing how to read a user inventory with a command so i can fill the new GUI with those items. I don't think /testfor is viable since i'd have to test for every single block present in the game and also i'd lose all the tags attached to an item (Edit: i've read that command is available only on BE, this is for JE). I tried to look at the documentation of /replaceitem but it doesn't seem useful either. Thanks in advance.

• Upvote, even though I believe it to be impossible. To my understanding, yes, you would have to test for everything; every item ID, every enchantment type and level, every banner pattern, every leather armour colour code, etc. Some parts could probably be made easier, for example you would only need binary search and therefore 13 commands to check all 12326391 possible leather colours, but you would also have to set whatever you have as a display, so unless that's a scoreboard display (like the sidebar), you would have to have one command per value. Or you transfer the number from the... – Fabian Röling Aug 29 '18 at 16:21
• ...scoreboard back into some NBT value. But even if you solve all of this, there's still the problem of item names, which can have up to 35 characters, as far as I know pretty much all of Unicode (1114112 different characters) is allowed, which makes the number of combinations a few novemsexagintillion or more than 600 command blocks even if binary search is somehow possible (which I doubt). And even if you're insane enough to program all of that, there are also shulker boxes, which make the number of possibilities explode once again (to whatever your previous number was to the power of 27). – Fabian Röling Aug 29 '18 at 16:30
• So your real question becomes: How accurate do you want this display to be? Is just item type enough? Or also damage? Or also leather armour dye? Or... – Fabian Röling Aug 29 '18 at 16:32
• I want it to be as accurate as possible, ideally the new GUI being a clone of the player's inventory (without the player being able to take back the items). If that's impossible with commands I'm not fixed on that and i could learn how to program a mod that does that. The data pack was just a convenient way to distribute the new feature to friends who play on my server. – plumbe0 Aug 29 '18 at 16:59
• You said you had the GUI already, what is it? Just a chest standing around that players can look into? Maybe that helps when creating the rest of the command system. – Fabian Röling Aug 29 '18 at 20:44