Command storage format

From Minecraft Wiki
Jump to navigation Jump to search
This feature is exclusive to Java Edition.
 

The command_storage.dat files are gzip compressed NBT files located in the data folder in a savegame under their respective <namespace> directory. They store information about the /data command storage in the world. Each namespace in the storage has its own data file.

Usage

[edit | edit source]

The command storage of NBT data is an efficient way for commands to access or save NBT data without an overhead for block entities or entities reading from or writing to the NBT data.

Each command storage is a general purpose, key-value storage, identified by a resource location to prevent unintentional conflicts.

/data get, /data modify, and /execute (if|unless) data can read from the storage, while /data merge, /data modify, /data remove, and /execute store can write to the storage.

The storage can also be accessed by text components.

Directory structure

[edit | edit source]
  • File directory.png: Sprite image for directory in Minecraft world save directory
    • File directory.png: Sprite image for directory in Minecraft data
      • File directory.png: Sprite image for directory in Minecraft <namespace>
        • File file.png: Sprite image for file in Minecraft command_storage.dat

Multiple <namespace> directory may be present in the data directory .

NBT structure

[edit | edit source]
  • [NBT Compound / JSON Object] The root tag.
    • [NBT Compound / JSON Object] data: The actual saved data.
      • [NBT Compound / JSON Object] contents: Contains all the data storage under the namespace of the command storage.
        • [NBT Compound / JSON Object] <path>: The data associated with a particular resource location <namespace>:<path>.
          • Custom content as set by the /data or /execute store commands.
    • [Int] DataVersion: The data version in which this file is saved.

Multiple [NBT Compound / JSON Object] compound tags of different names may exist under [NBT Compound / JSON Object] contents tag.

History

[edit | edit source]
Java Edition
1.1519w38aAdded command storage data for the level.
26.1snap6Change file location to data/<namespace>/command_storage.dat
[edit | edit source]