Minecraft Wiki
Advertisement
Information icon
This feature is exclusive to Java Edition. 

An NBT path is a descriptive label used to specify a collection of particular elements from an NBT data tree. A path has the general form node.….node, where each node declares what types of child tags can be chosen from previous tags.

Nodes[]

These are all seven types of nodes available.

The tags collection start with only one element (i.e. the root tag) and changes along the nodes when resolving path. Tags in the final tag collection are just the targets selected by the NBT path.

Name Format Description Selection Result Example Example Description
Root compound tag {tag}, where tag is the compound NBT content and can be empty. Selects the starting tag, only if it matches the specified content tag (if given).
Only applicable as the first element in an NBT path.
The starting tag, or nothing if matching fails. {Invisible:1b} Selects the root tag if it has a child tag  Invisible with value 1.
{} Selects the root tag.
Named tag name, where name can be a plain string or a quoted string Selects child tags named name in the previous tags. A collection of tags; no more elements than the previous tag collection. May be empty. VillagerData Selects the child tag named VillagerData.
"A cool name[]" Selects the child tag named A cool name[].
Named compound tag name{tag}, where name can be a plain or a quoted string, and tag is the compound NBT content which can be empty. Selects child tags named name in the previous tags, only if they are compound tags, and matching the specified content tag (if given). A collection of compound tags; no more elements than the previous tag collection. May be empty. VillagerData{profession:"minecraft:nitwit"} Select the child tag  VillagerData only if it has a child tag  profession with value minecraft:nitwit.
VillagerData{} Selects the child tag  VillagerData if it is a compound tag.
Element of named list or array tag name[index], where name can be a plain or a quoted string and index is an integer. Selects elements at index (or listLength + index if index is negative) of the child list (or array) tags named name in the previous tags. A collection of tags; no more elements than the previous tag collection. May be empty. Pos[0] Selects the first element in the child tag "Pos" list (or array).
Inventory[-1] Selects the last element in the child tag "Inventory" list (or array).
All elements of named list or array tag name[] Selects all elements of the child list (or array) tags named name in the previous tags. A collection of tags; may have more elements than the previous tag collection. May be empty. ActiveEffects[] Select all the elements in the child tag "ActiveEffects".
Compound Elements of Named List Tag name[{tag}], where name can be a plain or a quoted string and tag is the compound NBT content which can be empty. Selects elements in the child list tags named name in the previous tags, only if the elements are compound tags, and matching the specified content tag (if given). A collection of compound tags; may have more elements than the previous tag collection. May be empty. Inventory[{Count:25b}] Select compound elements of the child  Inventory tag that have a child tag  Count with value 25.
Foo[{}] Selects compound elements of the child  Foo tag.
Elements of the child list (or array) in named list tag name[index or blank][index or blank][index or blank]......[index or tag], where name can be a plain string or a quoted string, index is an integer, and tag is the compound NBT content which can be empty. Selects child elements of the child elements in the lists named name in the previous tags. A collection of tags; may have more elements than the previous tag collection. May be empty. foo[][{}] Select compound elements of the child lists in  foo list.
foo.bar[0][0].baz Select the baz tag in the first compound element of the first list element of the bar list in the  foo tag.

In an NBT path, . (dot/period) characters separate the nodes. Required nodes can be used arbitrarily, except the root compound tag node must be the first in the path when it is present.

Name escaping[]

The valid character set (without quote) for a path seems to be all non-whitespace characters, as long as any opening brackets and braces ([ and {) are closed and at the end of each node (that is, followed by nothing but a period or the end of the path). That being said, the "reasonable character set" for defining a tag name includes all ASCII lowercase and uppercase letters, digits, underscore, period, and square and curly brackets (Regular expression: [a-zA-Z0-9_\.[\]{}]*).

Quoted strings, such as "Lorem ipsum" or 'Lorem ipsum', can be used if a tag name needs to be escaped.

Examples[]

Mixed path[]

  • {}—Specifies the root tag
  • {foo:4.0f}—Specifies the root tag if its children tag "foo" is 4.0f
  • foo—Specifies the tag named "foo" under the root tag
  • foo.bar or foo{}.bar—Specifies foo's children tag named "bar".
  • foo.bar[0]—Specifies the first element of the list (or array) "bar"
  • foo.bar[-1]—Specifies the last element of the list (or array) "bar"
  • foo.bar[0]."A [crazy name]!"—Specifies the children tag named "A [crazy name]!" under that first element
  • foo.bar[0]."A [crazy name]!".baz—Specifies the children tag named "baz" under that crazily named tag
  • foo.bar[]—Specifies all elements of the list (or array) "bar"
  • foo.bar[].baz—Specifies the children tags named "baz" under all elements of the list "bar"
  • foo.bar[{baz:5b}]—Specifies all elements of the list "bar", in which the "baz" tags are 5b
  • foo{bar:"baz"}—Specifies the "foo" tag if its child tag "bar" has the value "baz"
  • foo{bar:"baz"}.bar—Specifies the "bar" tag under "foo", only if it matches the value "baz"

Example 1[]

/data get entity @p foo.bar[0]."A [crazy name]!".baz

These names have been arbitrarily picked, for demonstrative purposes.

  • foo—Specifies the subtag named "foo" under the root tag.
  • foo.bar—Specifies foo's child named "bar".
  • foo.bar[0]—Specifies the first element of the list "bar"
  • foo.bar[0]."A [crazy name]!"—Specifies the child named "A [crazy name]!" under that first element
  • foo.bar[0]."A [crazy name]!".baz—Specifies the child named "baz" under that crazily named element

Example 2[]

/data get block ~ ~ ~ Items[1].tag.pages[3]

A player has written a book and placed it inside a chest at their feet, and are going to work up to the above command in stages. Observe the following imaginary chat log:

History[]

Dark Oak Sapling
This article is a stub. 
You can help by expanding it.
Java Edition
1.20
{{Extension DPL}}<ul><li>[[Purple Dye|Purple Dye]]<br/>{{Item
| image = Purple_Dye_JE2_BE2.png
| renewable = Yes
| stackable = Yes (64)
}}
'''Purple dye''' is a [[Dyeing#Secondary colors|secondary dye color]] created by combining [[red dye]] and [[blue dye]] in a crafting grid.

== Obtaining ==

=== Crafting ===

{{Crafting
  |head=1
  |showname=0
  |Blue Dye
  |Red Dye
  |Output=Purple Dye,2
  |type=Material
}}
{{Crafting
  |foot=1
  |Lapis Lazuli
  |Red Dye
  |Output=Purple Dye,2
  |description={{only|bedrock|education}}
  |type=Material
}}

=== Trading ===

[[Wandering trader]]s sometimes sell 3 purple dye for an [[emerald]].

== Usage ==

{{dye usage}}

=== Crafting ingredient ===

{{crafting usage|ignore=Banner|continue=1}}
{{banner crafting usage}}

=== Loom ingredient ===
{{Banner loom usage|Purple Dye}}

=== Trading ===

Apprentice-level Shepherd villagers have a 20% chance to buy 12 purple dye for an emerald as part of their trades.{{only|bedrock}}

Expert-level Shepherd villagers have a {{frac|2|7}} chance to buy 12 purple dye for an emerald.{{only|java}}

== Data values ==
=== ID ===
{{edition|java}}:
{{ID table
|edition=java
|showforms=y
|generatetranslationkeys=y
|displayname=Purple Dye
|spritetype=item
|nameid=purple_dye
|form=item
|foot=1}}

{{edition|bedrock}}:
{{ID table
|edition=bedrock
|showaliasids=y
|shownumericids=y
|showforms=y
|notshowbeitemforms=y
|generatetranslationkeys=y
|displayname=Purple Dye
|spritetype=item
|nameid=purple_dye
|aliasid=dye / 5
|id=400
|form=item
|translationkey=item.dye.purple.name
|foot=1}}

== Video ==

<div style="text-align:center">{{yt|Cx52CGo5QnI}}</div>

== History ==

{{History|java beta}}
{{History||1.2|[[File:Purple Dye JE1 BE1.png|32px]] Added purple dye.}}
{{History|java}}
{{History||1.4.2|snap=12w34a|Added the ability to [[Armor#Dyeing|dye]] leather [[armor]] and [[wolf]] collars.}}
{{History||1.4.6|snap=12w49a|Purple dye can now be [[crafting|crafted]] with [[gunpowder]] to create a [[firework star]].}} 
{{History||1.6.1|snap=13w19a|[[Stained clay]] can now be crafted.}}
{{history||1.7.2|snap=13w36a|With the addition of new [[flower]]s, many secondary and tertiary dyes are now primary [[dye]]s.}}
{{History|||snap=13w41a|[[Stained glass]] can now be crafted.}}
{{History||1.8|snap=14w02a|Due to [[lapis lazuli]] being [[renewable resource|renewable]] now, purple dye is also now renewable.}}
{{History|||snap=14w30a|Added [[banner]]s which can be dyed.}}
{{History||1.13|snap=17w47a|The different data values for the <code>dye</code> ID have now been split up into their own IDs.
|Prior to [[1.13/Flattening|''The Flattening'']], this [[item]]'s numeral ID was 351.}}
{{History||1.14|snap=18w43a|Purple dye is now [[crafting|crafted]] using [[blue dye]], instead of [[lapis lazuli]].
|[[File:Purple_Dye_JE2_BE2.png|32px]] The texture of purple dye has now been changed.}}
{{History|||snap=18w44a|Purple dye can now change the text color on [[sign]]s to purple.}}
{{History|||snap=19w05a|Added the [[wandering trader]], which sells purple dye.}}
{{History|||snap=19w11a|Purple dye can now be [[trading|bought]] by shepherd villagers.}}
{{History||1.17|snap=20w45a|Purple dye can now be used to craft [[purple candle]]s.}}
{{History|||snap=21w19a|Purple dye can no longer be used to craft purple candles.}}
{{History|||snap=Pre-release 1|Purple dye can once again be used to craft purple candles.}}
{{History||1.20<br>(Experimental)|link=1.19.3|snap=22w42a|Purple dye can now change the text color on [[hanging sign]]s to purple.}}

{{History|pocket alpha}}
{{History||v0.3.0|[[File:Purple Dye JE1 BE1.png|32px]] Added purple dye. It is currently unobtainable and serves no purpose.}}
{{History||v0.4.0|Purple dye is now [[craft]]able with rose red and lapis lazuli.
|Purple dye can now be used to craft purple [[wool]].}}
{{History||v0.6.0|Purple dye can now be used to dye [[sheep]].}}
{{History||v0.8.0|snap=build 1|Purple dye can now be used to craft [[magenta dye]].}}
{{History||v0.9.0|snap=build 11|Purple dye can now be used to craft colored [[terracotta]].}}
{{History||v0.11.0|snap=build 1|Purple dye can now be used to dye tamed [[wolf]] collars.}}
{{History||v0.14.0|snap=build 1|Purple dye can now be used to dye [[water]] in [[cauldron]]s.}}
{{History|pocket}}
{{History||1.0.0|snap=alpha 0.17.0.1|Purple dye can now be used to dye [[shulker]]s.}}
{{History||1.1.0|snap=alpha 1.1.0.0|Purple dye can now be used to craft [[concrete powder]], colored [[bed]]s and dyed [[shulker box]]es.}}
{{History|bedrock}}
{{History||1.2.0|snap=beta 1.2.0.2|Purple dye can now be used to craft [[firework star]]s, [[stained glass]] and patterns on [[banner]]s.}}
{{History||1.4.0|snap=beta 1.2.20.1|Purple dye can now be used to craft [[balloon]]s and [[glow stick]]s.}}
{{History||1.8.0|snap=beta 1.8.0.8|Purple dye can now be used to dye tamed [[cat]] collars.}}
{{History||1.10.0|snap=beta 1.10.0.3|Purple dye is now [[trading|sold]] by [[wandering trader]]s.
|Purple dye can now be used to dye white [[carpet]]s and undyed [[glass pane]]s.
|[[File:Purple_Dye_JE2_BE2.png|32px]] The texture of purple dye has now been changed.}}
{{History||1.11.0|snap=beta 1.11.0.4|Purple dye can now be [[trading|sold]] to shepherd [[villager]]s.}}
{{History||1.16.100|snap=beta 1.16.100.56|The ID of purple dye has been changed from <code>dye/5</code> to <code>purple_dye</code>.}}

{{History|console}}
{{History||xbox=TU1|xbone=CU1|ps=1.00|switch=1.0.1|wiiu=Patch 1|[[File:Purple Dye JE1 BE1.png|32px]] Added purple dye.}}
{{History|PS4}}
{{History||1.90|[[File:Purple_Dye_JE2_BE2.png|32px]] The texture of purple dye has now been changed.}}

{{History|new 3ds}}
{{History||0.1.0|[[File:Purple Dye JE1 BE1.png|32px]] Added purple dye.}}
{{History|foot}}

== Issues ==

{{issue list}}

{{Items}}

[[Category:Items]]
[[Category:Dyes]]
[[Category:Renewable resources]]

[[cs:Fialové barvivo]]
[[de:Violetter Farbstoff]]
[[es:Tinte morado]]
[[fr:Teinture violette]]
[[hu:Lila festék]]
[[ja:紫色の染料]]
[[ko:보라색 염료]]
[[nl:Paarse kleurstof]]
[[pl:Fioletowy barwnik]]
[[pt:Corante roxo]]
[[ru:Фиолетовый краситель]]
[[zh:紫色染料]]</li><li>[[Photo|Photo]]<br/>{{exclusive|education}}
{{Item
| image = Photo EE2.png
| renewable = No (unless [[portfolio]] is available)
| stackable = 
}}

A '''photo''' is an [[item]] containing a picture taken with a [[camera]].<ref>{{cite|url=https://web.archive.org/web/20210925044841mp_/https://educommunity.minecraft.net/hc/en-us/articles/4407489082644-Feature-Walkthrough-Minecraft-Education-Edition-GOAT-Beta-version-1-17-30-| title = Feature Walkthrough Minecraft: Education Edition GOAT Beta (version 1.17.30)|website=Minecraft: Education Edition Support|date=September 24, 2021}}</ref><ref>{{cite|url=https://education.minecraft.net/en-us/blog/new-update-and-anniversary-for-mee| title = The GOAT Update Celebrates a Minecraft Milestone!|website=Minecraft: Education Edition|date=November 2, 2021}}</ref><ref>{{ytl|2Wd0J-EIfws|GOAT Release Playthrough|Minecraft: Education Edition|December 2, 2021}}</ref>

== Obtaining ==
A photo in a [[portfolio]] can be saved as a photo item by selecting the "Save to Inventory" button underneath it.

== Usage ==
Photos display an image when held in the hand or when placed in an [[item frame]], similarly to [[map]]s. Photos can have captions added to them by renaming them in an [[anvil]] or by adding a caption while they are in a portfolio. Photos can be added to [[book and quill]]s and portfolios by selecting the "Add Photo" button in the book and quill or portfolio.

== Data values ==
=== ID ===
{{ID table
|edition=bedrock
|shownumericids=y
|showforms=y
|notshowbeitemforms=y
|generatetranslationkeys=y
|displayname=Photo
|spritetype=item
|nameid=photo_item
|id=?
|form=item
|foot=1}}

== History ==
{{History|education}}
{{History||1.17.30|snap=1.17.30.2|[[File:Photo EE1.png|32px]] Added photos.}}
{{History||1.17.30|snap=release|[[File:Photo EE2.png|32px]] Changed photo texture.}}
{{History|foot}}

== Gallery ==
<gallery>
Photo Item 1.png|A photo being placed in an item frame.
Photo Item 2.png|A photo being saved from a portfolio.
Photo Item 3.png|A photo being added to a book and quill.
</gallery>

== References ==
{{Reflist}}

{{Items}}
{{Education Edition}}

[[Category:Education Edition items]]
[[Category:Non-renewable resources]]

[[ja:写真]]
[[pl:Zdjęcie]]
[[zh:相片]]</li></ul>
Pre-release 2Single quotation marks are now supported in NBT paths.[1]

References[]

  1. MC-175504 — "Single quotation marks are not supported in NBT paths." — resolved as "Fixed".
Advertisement