OmniGame logoOmniGame

/data Command

Reads, writes, and modifies NBT data on block entities, living entities, and command storage namespaces. `get` prints or returns a value scaled by a float, `merge` deep-merges a compound, `remove` deletes a path, and `modify` performs list/compound operations (set, append, prepend, insert, merge) from another NBT source or a literal value.

Syntax
data get (block <targetPos>|entity <target>|storage <resource_location>) [<path>] [<scale>] data merge (block <targetPos>|entity <target>|storage <resource_location>) <nbt> data remove (block <targetPos>|entity <target>|storage <resource_location>) <path> data modify (block <targetPos>|entity <target>|storage <resource_location>) <targetPath> (append|prepend|set|merge) from (block <sourcePos>|entity <source>|storage <resource_location>) [<sourcePath>] (append|prepend|set|merge) string (block <sourcePos>|entity <source>|storage <resource_location>) [<sourcePath>] [<start>] [<end>] (append|prepend|set|merge) value <value> insert <index> from ... insert <index> string ... insert <index> value <value>
Permission: 2Edition: Java

Examples

data get entity @s SelectedItem.iddata merge block ~ ~ ~ {CustomName:'{"text":"Magic Chest"}'}data modify storage mypack:temp value set value {count: 0}data modify entity @s HandItems[0] set from storage mypack:items sword

Notes

Exclusive to Java Edition. Command storage (`storage`) is a persistent key-value NBT namespace not tied to any entity or block, useful for datapacks. `data remove` cannot remove individual elements from a list by index — use `data modify … remove` patterns instead. `scale` in `data get` is a multiplier applied before truncating to integer, useful for feeding float values into scores via `execute store`.

More commands