Skip to main content
Version: 26.1+

Data Attachments

Data attachments are named pieces of data that can be stored on any entity. They are primarily used as custom variables that powers and abilities can read from and write to, for instance, tracking a cooldown timer, storing a player's skin state, or holding a custom counter.

Data attachment files go in:

addon/<namespace>/data_attachment/<id>.json

Fields

FieldTypeDefaultDescription
typeStringThe data type stored in this attachment. See Types below.
sync_withStringWho the value is synced to. One of none, self, all.
copy_on_deathBooleantrueWhen true, the value is preserved when the player respawns.

sync_with

ValueDescription
noneThe value is never synced to any client. Use this for purely server-side data.
selfThe value is synced only to the player who owns it.
allThe value is synced to all players within tracking range.

Types

TypeDefault valueDescription
palladium:byte0An 8-bit integer (-128 to 127).
palladium:short0A 16-bit integer (-32768 to 32767).
palladium:integer0A 32-bit integer.
palladium:long0A 64-bit integer.
palladium:float0.0A 32-bit floating point number.
palladium:double0.0A 64-bit floating point number.
palladium:booleanfalseA true/false value.
palladium:string""A text string.
palladium:componentemptyA Minecraft text component.

Each type also has a corresponding array variant (e.g. palladium:integer_array) that stores a list of values of that type. The default value for array types is an empty list.


Examples

addon/mypack/data_attachment/cooldown_timer.json
{
"type": "palladium:integer",
"sync_with": "self",
"copy_on_death": false
}
addon/mypack/data_attachment/display_name.json
{
"type": "palladium:string",
"sync_with": "all",
"copy_on_death": true
}

Command

The value of a data attachment on an entity can be read or overwritten using the /palladium data-attachment command. Requires operator-level permissions (game master).

Get the current value on an entity:

/palladium data-attachment get entity <entity> <type>

Set a new value on one or more entities:

/palladium data-attachment set entity <entities> <type> <value>

The <type> argument is the registry ID of the attachment (e.g. mypack:cooldown_timer). The <value> is provided as an NBT tag matching the attachment's type, for example 42 for an integer, or "hello" for a string.