Minecraft Inventory Saving

Minecraft Inventory Saving - Free stock photo of adult, aisle, beard

I am making an RPG map, and was wondering how to "save" the game. If you die, you would revert back to a save that happens automatically or manually, and I was wondering how to have it so that you will have all the items you had then, and none of the items you got after you saved (so /gamerule keepInventory won't work). The only way I can think of doing this is having this long, long, annoying set of command blocks to test for all the items in the game, and then have another 64 command blocks for each of those items, testing for the amount of the item.



Best Answer

I've got a solution, but it's a bit ugly; it involves killing the player and having them reorganize their inventory at each save. You'll also need keepInventory off.

Whenever you want to save, teleport the player to an enclosed cell with a hopper on the floor and chest below, then kill them; all of their items should go into the chest. If there were already items in the chest from a previous save, you'll need to /setblock the chest to clear it first. /clone this chest with their items to another enclosed cell.

When the player dies, teleport them to the cloned chest and break the chest. All of their items in the cloned chest (that they had when they saved) will fall into their inventory. /clone the chest again form the original one in case they die again. Then you'll just need to teleport the player out of the cell back to where they were when they saved.




Pictures about "Minecraft Inventory Saving"

Minecraft Inventory Saving - Free stock photo of aisle, architecture, beard
Minecraft Inventory Saving - People in Store
Minecraft Inventory Saving - Warehouse with Concrete Floors



Quick Answer about "Minecraft Inventory Saving"

  • Open the Chat Window. The easiest way to run a command in Minecraft is within the chat window.
  • Type the Command. In this example, we will set the gamerule to keep inventory after dying with the following command: /gamerule keepInventory true. The game rule will be changed for your world.


How do I save my inventory in Minecraft?

Open the chat window in your game. Type \u201c/gamerule keepInventory true\u201d in the chatbox. Press \u201cEnter.\u201d After you die, you'll still have all your tools.

Where are Minecraft inventories saved?

This is usually stored in the main world folder for your MC server hosting server and tracks health, inventory data, ender chests, and a few other NBT values for players (such as their last location). The second type of player data is known as \u201cplugin player data\u201d.



How to Save \u0026 Load Hotbars in Minecraft




More answers regarding minecraft Inventory Saving

Answer 2

This video here might be able to help you. The only way I can think of is to have 36 command blocks to test for what item is in your inventory, and have the command blocks run simultaneously once the save command is executed. Then, when the player dies, it gives back all items that the 36 command blocks checked for.

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: cottonbro, cottonbro, cottonbro, Tiger Lily