Skip to content

Data components and codecs

Status: Planned. Mod-defined data component types, codecs, and reading or writing components on item stacks. Nothing on this page is in the API yet; the names in the final API may differ.

What this will cover

In 26.3 most item properties are data components (max_stack_size, max_damage, food, tool, equippable, consumable, …). This page will document:

  • reading and writing any component on an item stack (get, set, remove), including the vanilla ones;
  • registering your own component types with a codec, so they save with the stack and sync to clients;
  • codecs (JSON and network forms) that other planned APIs (worldgen configs, recipe serializers) share.

What you can do today

  • Mod items get custom_data, item_model, item_name and max_stack_size automatically (Items and item stacks).
  • Data packs can set components on loot (set_components loot functions) and recipe results with vanilla items.
  • /give @s minecraft:stick[minecraft:custom_name='"Wand"'] style commands work through cl_cmd_run.