Commands/data

Allows the player to get, merge, and remove block entity and entity NBT data.


 * Syntax

There are four instructions for the  command ("get", "merge", "modify", "remove"), and every target and source referenced by the command can be either a block or an entity, so describing syntax takes a largely branching tree.

Complete tree:

Simplified tree:
 * where italicised arguments are:
 * where italicised arguments are:
 * where italicised arguments are:
 * where italicised arguments are:
 * where italicised arguments are:
 * where italicised arguments are:
 * where italicised arguments are:


 * Arguments


 * or
 * Target block position OR entity whose NBT data is to be read, merged, modified, or removed


 * or
 * Source block position OR entity whose NBT data is to be used for modifying the target's NBT data


 * For
 * &mdash;Specifies the path name to the NBT to retrieve (Optional)
 * Data paths look like this:.
 * means foo's child called bar.
 * means element 0 of foo.
 * "quoted strings" may be used if a name of a key needs to be escaped.
 * &mdash;Scales the number retrieved (Optional)


 * For
 * &mdash;Specifies the NBT tag to be merged/removed


 * For
 * &mdash;Specifies the path name to the NBT to modify
 * Operations:
 * &mdash;
 * &mdash;
 * &mdash;
 * &mdash;
 * &mdash;


 * For
 * &mdash;Specifies the path name to the NBT to remove


 * Result


 * Fails if the arguments are not specified correctly.


 * On success:
 * &mdash;Return value depends on what arguments are specified.
 * No additional arguments
 * Return 1 and read off the entire NBT data from the targeted block position or entity to the executor with syntax highlighting, and returns 1.
 * Only
 * Sends the subsection of the NBT data from the targeted block position or entity to the executor without syntax highlighting. Return value depends on the type of the NBT element:
 * Retrieving a number will return that number.
 * Retrieving a string will return the length of the string.
 * Retrieving a list will return the number of elements in that list.
 * Retrieving a compound will return the number of tags that are direct children of that compound.
 * Both and
 * Requires a numeric value to be at the end of the path. Returns that numeric value scaled by scale.
 * &mdash;Merges the NBT data from the sourced block position or entity with the specified data. Returns 1 on success.
 * &mdash;Will remove NBT data at from the targeted block position or entity. Removing player NBT data is not allowed. Returns 1 on success.

History
命令/data