We've all been there. Well, probably not, but I just did like an idiot.

First off, **do not quit the game.** Do not save and quit, do not `alt`\+`F4`, do not quit via task manger. Just pause it.

If you've already quit the game, **do not open it again.** There still *may* be a chance this works, but if you open it again and have no other backups, I think you're probably out of luck.

In file explorer, find your world's save folder. This should work on servers too. Go into the `playerdata` folder, and find your `.dat` and `.dat_old` files. If it's a single player world, there will only be one of each, if it's mulitplayer, go into a singleplayer world folder to find your UUID, and then find the files that match in the multiplayer world.

Copy them and paste them one folder up, in the world folder. At this point, you should be able to close the game/stop the server.

If this is a server, I don't believe that the `level.dat` file holds any player information. Theoretically, all you should have to do is close the server, copy your player `.dat` file back into the `playerdata` folder, and restart the server. If that didn't work, try using your player `.dat_old` instead by removing `_old` from the file extension. If still no, your items may be lost.

For singleplayer worlds, make a backup copy of your player `.dat`, `.dat_old`, and of `level.dat`, because we're going to be editing these files directly, and messing that up could result in more than just your inventory being lost. If you're not using the minecraft launcher, copy the world and paste it into your general singleplayer minecraft saves folder.

Get [NBTExplorer](https://github.com/jaquadro/NBTExplorer/releases/tag/v2.8.0-win), find the save, and open the copied `.dat` file. You should see `equipment` and `Inventory` as listed entries with tags inside matching your lost items. If there is no `equipment` folder and `Inventory` is empty, instead open the copied `.dat_old` file and see if they're there. If also empty, unless you have an older world backup, your items are likely lost.

If however you do see the `equipment` and `Inventory` entries, open the `level.dat` file alongside your player's `.dat` file, and open `Data` \> `Player`. Using the toolbar, click the `level.dat` `Inventory` tag and delete it, then copy and paste the `equipment` folder and `Inventory` tag from your player `.dat` into the `level.dat` `Player`. If you mess anything up, feel free to start again from the backup you made earlier (though, obviously, keep that backup in case you mess up again).

[level.dat correct Player folder](https://preview.redd.it/mu8goxcux4gg1.png?width=241&format=png&auto=webp&s=50f5b5a467996e59bb11c323992b845b2dc7e756)

In the end, you should have a level.dat file which has a Player folder with an equipment folder. Click the floppy disk to save, and try to load the world (if you use a different launcher, make sure to move this save back. Makes as many copies of the original as you want, just in case). Theoretically, you should have your items back.

This worked for me, but good luck! If anyone has suggestions to make this guide better, feel free to let me know.

Voir le contenu lié