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.
Minecraft – Minecraft command to retrieve a player inventory?
minecraft-commandsminecraft-java-edition
Related Topic
- Minecraft Java Edition – How to Save Minecraft Inventory Using Commands in Minecraft Java Edition
- Minecraft – Location specific inventory retention in Minecraft
- Minecraft Java Edition – How to Use Inventory Scanner Commands
- Minecraft Inventory Testing
- Minecraft Commands – Force Player to Close Their Inventory
Best Answer
It seems that this is not possible. Maybe you could do something that detects if the player dies and teleports all the items on the ground or something along those lines. Perhaps using hoppers. You could also make sure that it doesn't teleport other items in the world by doing a radius. Although to my knowledge doing it any other way is impossible. You can use a scoreboard objective to test if the player has died.