Minecraft:Identifier: Difference between revisions
More actions
Remove broken links to missing pages |
Fix template calls: add MC/ prefix |
||
| Line 56: | Line 56: | ||
When the <code>:</code> is present, the part of the string before the <code>:</code> becomes the namespace, and the part of the string after the <code>:</code> becomes the path. | When the <code>:</code> is present, the part of the string before the <code>:</code> becomes the namespace, and the part of the string after the <code>:</code> becomes the path. | ||
{{ | {{MC/In|java}}, and in some cases {{MC/In|bedrock}}, when the <code>:</code> is absent, [[#minecraft namespace|<code>minecraft</code>]] becomes the namespace and the whole string becomes the path. | ||
It is recommended to always include a <code>:</code> in the string format of identifiers. | It is recommended to always include a <code>:</code> in the string format of identifiers. | ||
| Line 78: | Line 78: | ||
*<code>diamond</code>{{only|bedrock}} | *<code>diamond</code>{{only|bedrock}} | ||
|- | |- | ||
| <code>:dirt</code> || <code>minecraft</code> || <code>dirt</code> || <code>minecraft:dirt</code>{{ | | <code>:dirt</code> || <code>minecraft</code> || <code>dirt</code> || <code>minecraft:dirt</code>{{MC/Needs testing|bedrock=1}} | ||
|- | |- | ||
| <code>minecraft:</code> || <code>minecraft</code> || None || <code>minecraft:</code>{{ | | <code>minecraft:</code> || <code>minecraft</code> || None || <code>minecraft:</code>{{MC/Needs testing|bedrock=1}} | ||
|- | |- | ||
| <code>:</code> || <code>minecraft</code> || None || <code>minecraft:</code>{{ | | <code>:</code> || <code>minecraft</code> || None || <code>minecraft:</code>{{MC/Needs testing|bedrock=1}} | ||
|- | |- | ||
| Empty String || <code>minecraft</code> || None || <code>minecraft:</code>{{ | | Empty String || <code>minecraft</code> || None || <code>minecraft:</code>{{MC/Needs testing|bedrock=1}} | ||
|- | |- | ||
| <code>foo/bar:coal</code> || Invalid character <code>/</code> || || | | <code>foo/bar:coal</code> || Invalid character <code>/</code> || || | ||
| Line 111: | Line 111: | ||
== ''Java Edition'' usage == | == ''Java Edition'' usage == | ||
{{ | {{MC/WIP|section=1}} | ||
{{ | {{MC/In|java}}, identifiers act mainly as main keys of objects in registries or file paths of contents in data packs and resource packs. Some non-customizable contents also use identifiers to identify them. | ||
=== Registries and registry objects === | === Registries and registry objects === | ||
{{ | {{MC/Update|section=1|Lots of tags seem missing, see :zh:注册表 for reference to add here if you speak Chinese}} | ||
<div class="treeview"> | <div class="treeview"> | ||
All registries and objects therein have identifiers to represent them. At the root of all registries is a registry with the identifier of {{ | All registries and objects therein have identifiers to represent them. At the root of all registries is a registry with the identifier of {{MC/Cd|minecraft:root|inline=1}} into which all other registries are registered. Most registries are intended only for use internally by the game and by extension by mods, but some ''dynamic'' registries can have content added to them through data packs, marked in the list below with an asterisk (<span style="color:#d33">*</span>). | ||
* {{File|directory|minecraft:root|inline=1}}: Root registry. | * {{File|directory|minecraft:root|inline=1}}: Root registry. | ||
| Line 246: | Line 246: | ||
==== Locating contents in packs ==== | ==== Locating contents in packs ==== | ||
Given that objects in resource packs and data packs are files, the identifiers are constructed from their path relative to the {{ | Given that objects in resource packs and data packs are files, the identifiers are constructed from their path relative to the {{MC/Cd|data}} or {{MC/Cd|assets}} folder. | ||
Though the locations vary by object type and the pack type the object type belongs to, there is a pattern to follow. In general, the location is in the fashion of pack_type/namespace/object_type/name.suffix, where all the / (forward slash) symbol (may be part of object_type or name) is replaced by operating system-dependent directory separator. | Though the locations vary by object type and the pack type the object type belongs to, there is a pattern to follow. In general, the location is in the fashion of pack_type/namespace/object_type/name.suffix, where all the / (forward slash) symbol (may be part of object_type or name) is replaced by operating system-dependent directory separator. | ||
Given the type of content we want to locate, we can find out the corresponding {{ | Given the type of content we want to locate, we can find out the corresponding {{MC/Cd|''pack_type''}}, {{MC/Cd|''object_type''}}, and {{MC/Cd|''suffix''}}. Then, we can substitute in and find out the final file location of the content. | ||
<div class="collapsible collapsed collapsetoggle-inline" data-expandtext="show" data-collapsetext="hide"> | <div class="collapsible collapsed collapsetoggle-inline" data-expandtext="show" data-collapsetext="hide"> | ||
| Line 258: | Line 258: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Identifier !! Content Type !! {{ | ! Identifier !! Content Type !! {{MC/Cd|''pack_type''}} !! {{MC/Cd|''object_type''}} !! {{MC/Cd|''suffix''}} !! Final Location | ||
|- | |- | ||
| {{ | | {{MC/Cd|my_texture_pack:diamonds}} || Texture || {{MC/Cd|assets}} || {{MC/Cd|textures}} || {{MC/Cd|png}} || {{MC/Cd|assets/my_texture_pack/textures/diamonds.png}} | ||
|- | |- | ||
| {{ | | {{MC/Cd|abc:run_game}} || Function || {{MC/Cd|data}} || {{MC/Cd|functions}} || {{MC/Cd|mcfunction}} || {{MC/Cd|data/abc/functions/run_game.mcfunction}} | ||
|- | |- | ||
| {{ | | {{MC/Cd|block/torch}}<br>(same as {{MC/Cd|minecraft:block/torch}}) || Model || {{MC/Cd|assets}} || {{MC/Cd|models}} || {{MC/Cd|json}} || {{MC/Cd|assets/minecraft/models/block/torch.json}} | ||
|- | |- | ||
| {{ | | {{MC/Cd|load}}<br>(same as {{MC/Cd|minecraft:load}}) || Function Tag || {{MC/Cd|data}} || {{MC/Cd|tags/functions}} || {{MC/Cd|json}} || {{MC/Cd|data/minecraft/tags/functions/load.json}} | ||
|- | |- | ||
| {{ | | {{MC/Cd|rocket_pack:industry/start_of_story}} || Advancement || {{MC/Cd|data}} || {{MC/Cd|advancements}} || {{MC/Cd|json}} || {{MC/Cd|data/rocket_pack/advancements/industry/start_of_story.json}} | ||
|} | |} | ||
</div></div> | </div></div> | ||
| Line 282: | Line 282: | ||
! Content Type !! Registered into !! Folder !! Suffix | ! Content Type !! Registered into !! Folder !! Suffix | ||
|- | |- | ||
| Dimensions || {{ | | Dimensions || {{MC/Cd|minecraft:dimension}} || {{MC/Cd|data/''namespace''/dimension}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Dimension types || {{ | | Dimension types || {{MC/Cd|minecraft:dimension_type}} || {{MC/Cd|data/''namespace''/dimension_type}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Configured carvers || {{ | | Configured carvers || {{MC/Cd|minecraft:worldgen/configured_carver}} || {{MC/Cd|data/''namespace''/worldgen/configured_carver}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Configured features || {{ | | Configured features || {{MC/Cd|minecraft:worldgen/configured_feature}} || {{MC/Cd|data/''namespace''/worldgen/configured_feature}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Configured structure features || {{ | | Configured structure features || {{MC/Cd|minecraft:worldgen/structure}} || {{MC/Cd|data/''namespace''/worldgen/structure}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Structure sets || {{ | | Structure sets || {{MC/Cd|minecraft:worldgen/structure_set}} || {{MC/Cd|data/''namespace''/worldgen/structure_set}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Processor lists || {{ | | Processor lists || {{MC/Cd|minecraft:worldgen/processor_list}} || {{MC/Cd|data/''namespace''/worldgen/processor_list}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Template pools || {{ | | Template pools || {{MC/Cd|minecraft:worldgen/template_pool}} || {{MC/Cd|data/''namespace''/worldgen/template_pool}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Placed features || {{ | | Placed features || {{MC/Cd|minecraft:worldgen/placed_feature}} || {{MC/Cd|data/''namespace''/worldgen/placed_feature}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Biomes || {{ | | Biomes || {{MC/Cd|minecraft:worldgen/biome}} || {{MC/Cd|data/''namespace''/worldgen/biome}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Noise || {{ | | Noise || {{MC/Cd|minecraft:worldgen/noise}} || {{MC/Cd|data/''namespace''/worldgen/noise}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Noise generator settings || {{ | | Noise generator settings || {{MC/Cd|minecraft:worldgen/noise_settings}} || {{MC/Cd|data/''namespace''/worldgen/noise_settings}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Density functions || {{ | | Density functions || {{MC/Cd|minecraft:worldgen/density_function}} || {{MC/Cd|data/''namespace''/worldgen/density_function}} || {{MC/Cd|json}} | ||
|- | |- | ||
| Flat level generator presets || {{ | | Flat level generator presets || {{MC/Cd|minecraft:worldgen/flat_level_generator_preset}} || {{MC/Cd|data/''namespace''/worldgen/flat_level_generator_preset}} || {{MC/Cd|json}} | ||
|- | |- | ||
| World presets || {{ | | World presets || {{MC/Cd|minecraft:worldgen/world_preset}} || {{MC/Cd|data/''namespace''/worldgen/world_preset}} || {{MC/Cd|json}} | ||
|} | |} | ||
</div></div> | </div></div> | ||
| Line 403: | Line 403: | ||
== Namespaces == | == Namespaces == | ||
{{quote|This isn't a new concept, but I thought I should reiterate what a "namespace" is. Most things in the game has a namespace, so that if we add {{ | {{quote|This isn't a new concept, but I thought I should reiterate what a "namespace" is. Most things in the game has a namespace, so that if we add {{MC/Cd|something}} and a mod (or map, or whatever) adds {{MC/Cd|something}}, they're both different {{MC/Cd|something}}s. Whenever you're asked to name something, for example a loot table, you're expected to also provide what namespace that thing comes from. If you don't specify the namespace, we default to {{MC/Cd|minecraft}}. This means that {{MC/Cd|something}} and {{MC/Cd|minecraft:something}} are the same thing.|Dinnerbone|namespaces<ref>{{snap|17w43a}}</ref>|Nathan Adams Mojang avatar.png}} | ||
A namespace is a domain for content. It is to prevent potential content conflicts or unintentional overrides of objects of the same name. | A namespace is a domain for content. It is to prevent potential content conflicts or unintentional overrides of objects of the same name. | ||
For example, two data packs add two minigame mechanisms to Minecraft; both have a function named {{ | For example, two data packs add two minigame mechanisms to Minecraft; both have a function named {{MC/Cd|start}}. Without namespaces, these two functions would clash and the minigames would be broken. When they have different namespaces of {{MC/Cd|minigame_one}} and {{MC/Cd|minigame_two}}, the functions would become {{MC/Cd|minigame_one:start}} and {{MC/Cd|minigame_two:start}}, which no longer conflict. | ||
=== {{ | === {{MC/Cd|minecraft}} namespace === | ||
Minecraft reserves the {{ | Minecraft reserves the {{MC/Cd|minecraft}} namespace. When a namespace is not specified, an identifier falls back to {{MC/Cd|minecraft}}{{only|java}}. As a result, the {{MC/Cd|minecraft}} namespace should only be used by content creators when the content needs to overwrite or modify existing Minecraft data, such as adding a function to the {{MC/Cd|minecraft:load}} function tag. | ||
=== Custom namespace === | === Custom namespace === | ||
| Line 416: | Line 416: | ||
To prevent potential clashes, it is recommended that the namespace should be as specific as possible: | To prevent potential clashes, it is recommended that the namespace should be as specific as possible: | ||
*Avoid [[Wikipedia:Alphabet soup (linguistics)|alphabet soups]]. For example, a project named "nuclear craft" should not use the namespace {{ | *Avoid [[Wikipedia:Alphabet soup (linguistics)|alphabet soups]]. For example, a project named "nuclear craft" should not use the namespace {{MC/Cd|nc}}, as this is too ambiguous. | ||
*Avoid words that are too vague. {{ | *Avoid words that are too vague. {{MC/Cd|battle_royale}} would not be informative to look up as well, but {{MC/Cd|''player_name''_battle_royale}} would be much better. | ||
*For [[Minecraft:add-on]]s, use a shortened creator name followed by the name of the project in a format like {{ | *For [[Minecraft:add-on]]s, use a shortened creator name followed by the name of the project in a format like {{MC/Cd|creatorname_packname}}.<ref name="cooperative"/> | ||
In either case, these poorly chosen namespaces reduce the exposure of a project and bring difficulties for debugging when there are multiple content creations applied to the game. | In either case, these poorly chosen namespaces reduce the exposure of a project and bring difficulties for debugging when there are multiple content creations applied to the game. | ||
=== Other built-in namespaces === | === Other built-in namespaces === | ||
{{ | {{MC/In|je}}, the vanilla Minecraft resource pack declares Realms-oriented language files in the {{MC/Cd|realms}} namespace (located at assets/realms/lang/.json) and game-related language files in the {{MC/Cd|minecraft}} namespace, even though translation keys are not identifiers. The realms jar itself also declares its en_us.json language file and its various textures in the {{MC/Cd|realms}} namespace. | ||
In the IDs of command argument types, a {{ | In the IDs of command argument types, a {{MC/Cd|brigadier}} namespace also appears for command argument types that are native to Brigadier. | ||
{{ | {{MC/In|be}}, the internal resource and behavior packs for ''[[Minecraft:Bedrock Editor]]'' contain some entities and items namespaced with <code>editor</code>. | ||
== History == | == History == | ||
=== ''Java Edition'' === | === ''Java Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|java}} | |{{MC/HistoryLine|java}} | ||
|{{HistoryLine||1.6.1|dev=13w21a|Added resource locations alongside the {{ | |{{HistoryLine||1.6.1|dev=13w21a|Added resource locations alongside the {{MC/Cd|minecraft}} prefix for identifying assets.}} | ||
|{{HistoryLine||1.7.2|dev=13w37a|Commands now accept name IDs aside from numerical IDs.}} | |{{MC/HistoryLine||1.7.2|dev=13w37a|Commands now accept name IDs aside from numerical IDs.}} | ||
|{{HistoryLine||1.8|dev=14w02a|Item ID format has changed from using numbers (for example, TNT's id was 46) to namespaced IDs of the form minecraft:item_name. (Example: minecraft:tnt)}} | |{{MC/HistoryLine||1.8|dev=14w02a|Item ID format has changed from using numbers (for example, TNT's id was 46) to namespaced IDs of the form minecraft:item_name. (Example: minecraft:tnt)}} | ||
|{{HistoryLine||1.11|dev=16w32a|Resource locations now have a character restriction. | |{{MC/HistoryLine||1.11|dev=16w32a|Resource locations now have a character restriction. | ||
|Disallowed uppercase characters in resource locations.}} | |Disallowed uppercase characters in resource locations.}} | ||
|{{HistoryLine||1.13|dev=17w47a|After the flattening, resource locations are the only accepted form of identifiers.}} | |{{MC/HistoryLine||1.13|dev=17w47a|After the flattening, resource locations are the only accepted form of identifiers.}} | ||
|{{HistoryLine|||dev=pre4|Resource locations are now used to identify plugin message channels.<ref>[https://wiki.vg/Protocol_History#1.13-pre4 Protocol History] – wiki.vg</ref>}} | |{{MC/HistoryLine|||dev=pre4|Resource locations are now used to identify plugin message channels.<ref>[https://wiki.vg/Protocol_History#1.13-pre4 Protocol History] – wiki.vg</ref>}} | ||
|{{HistoryLine||1.14.4|dev=pre1|The <samp>realms</samp> namespace is added to the [[Minecraft:Client.jar|client jar]]'s builtin resource pack.}} | |{{MC/HistoryLine||1.14.4|dev=pre1|The <samp>realms</samp> namespace is added to the [[Minecraft:Client.jar|client jar]]'s builtin resource pack.}} | ||
|{{HistoryLine||1.16|dev=20w14a|[[Minecraft:Attribute]]s are now resource locations.}} | |{{MC/HistoryLine||1.16|dev=20w14a|[[Minecraft:Attribute]]s are now resource locations.}} | ||
|{{HistoryLine||1.21.11|dev=25w45a|<code>ResourceLocation</code> is renamed to <code>Identifier</code> in the game's code.}} | |{{MC/HistoryLine||1.21.11|dev=25w45a|<code>ResourceLocation</code> is renamed to <code>Identifier</code> in the game's code.}} | ||
}} | }} | ||
=== ''Bedrock Edition'' === | === ''Bedrock Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|pocket alpha}} | |{{MC/HistoryLine|pocket alpha}} | ||
|{{HistoryLine||v0.16.0|dev=build 1|Added [[Minecraft:commands]], which supported string IDs. However, these identifiers were not namespaced yet.}} | |{{MC/HistoryLine||v0.16.0|dev=build 1|Added [[Minecraft:commands]], which supported string IDs. However, these identifiers were not namespaced yet.}} | ||
|{{HistoryLine|||dev=build 4|All entity [[Minecraft:attribute]]s are now namespaced.}} | |{{MC/HistoryLine|||dev=build 4|All entity [[Minecraft:attribute]]s are now namespaced.}} | ||
|{{HistoryLine|bedrock}} | |{{MC/HistoryLine|bedrock}} | ||
|{{HistoryLine||1.6.0|dev=beta 1.6.0.5|In the save files for worlds, items now use namespaced IDs instead of numeric IDs.}} | |{{MC/HistoryLine||1.6.0|dev=beta 1.6.0.5|In the save files for worlds, items now use namespaced IDs instead of numeric IDs.}} | ||
|{{HistoryLine||1.12.0|dev=beta 1.12.0.2|IDs are now namespaced using the {{ | |{{HistoryLine||1.12.0|dev=beta 1.12.0.2|IDs are now namespaced using the {{MC/Cd|minecraft}} prefix, to support custom items being added through [[Minecraft:add-on]]s.}} | ||
}} | }} | ||
| Line 464: | Line 464: | ||
== References == | == References == | ||
{{ | {{MC/Reflist}} | ||
== External links == | == External links == | ||
| Line 470: | Line 470: | ||
== Navigation == | == Navigation == | ||
{{Navbox Java Edition technical|general}} | {{MC/Navbox Java Edition technical|general}} | ||
{{Navbox Bedrock Edition}} | {{MC/Navbox Bedrock Edition}} | ||
de:Namensraum | de:Namensraum | ||
Revision as of 20:29, 9 April 2026
Identifiers (also known as resource locations, namespaced IDs, namespaced identifiers, resource identifiers,<ref>Template:Snap</ref> or namespaced strings<ref>DataFixerUpper/NamespacedStringType.java at 8b5f82ab78b30ff5813b3a7f3906cd3f4f732acf · Mojang/DataFixerUpper – GitHub</ref>) are a way to declare and specify game objects in Minecraft, which can identify built-in and user-defined objects without potential ambiguity or conflicts.
Introduction
Identifiers are used as plain strings to reference Minecraft:blocks, Minecraft:items, entity types, and various other objects in vanilla Minecraft.
A valid identifier has a format of namespace:path, where only certain characters can be used.
Legal characters
Java Edition
The namespace and the path of an identifier should only contain the following symbols:
0123456789NumbersabcdefghijklmnopqrstuvwxyzLowercase letters_Underscore-Hyphen/minus.Dot
The following characters are illegal in the namespace, but acceptable in the path:
/Forward slash (directory separator)
The preferred naming convention for either namespace or path is snake_case.
Bedrock Edition
The namespace and the path of a namespaced ID can contain all symbols with the exception of slashes and colons.
The following characters are illegal in the namespace, but acceptable in the path of loot tables and functions.
/Forward slash (directory separator)
The preferred naming convention for either namespace or path is snake_case.
Conversion to string
An identifier is converted to a string by concatenating its namespace with a : (colon) and its path.
Examples:
| Namespace | Path | String representation |
|---|---|---|
minecraft |
diamond |
minecraft:diamond
|
foo |
bar.baz |
foo:bar.baz
|
minecraftwiki |
commands/minecraft_wiki |
minecraftwiki:commands/minecraft_wiki
|
Conversion from string
All identifiers can be converted to strings; however, not all strings can be converted to identifiers.
For a string to be converted, it must follow these restrictions:
- The string may have at most one
:(colon) character - The rest of the string must fulfill the requirement for legal characters. This includes disallowing
/(forward slash) characters before the:, if a:is present
When the : is present, the part of the string before the : becomes the namespace, and the part of the string after the : becomes the path.
in Template:Editions, and in some cases in Template:Editions, when the : is absent, minecraft becomes the namespace and the whole string becomes the path.
It is recommended to always include a : in the string format of identifiers.
- Examples
| String | Resolved namespace | Resolved path | What the game converts it back to |
|---|---|---|---|
bar:code |
bar |
code |
bar:code
|
minecraft:zombie |
minecraft |
zombie |
minecraft:zombie
|
diamond
|
|
diamond
|
|
:dirt |
minecraft |
dirt |
minecraft:dirt<needs testing in Bedrock Edition></needs testing in Bedrock Edition>
|
minecraft: |
minecraft |
None | minecraft:<needs testing in Bedrock Edition></needs testing in Bedrock Edition>
|
: |
minecraft |
None | minecraft:<needs testing in Bedrock Edition></needs testing in Bedrock Edition>
|
| Empty String | minecraft |
None | minecraft:<needs testing in Bedrock Edition></needs testing in Bedrock Edition>
|
foo/bar:coal |
Invalid character / |
||
minecraft/villager
|
|
minecraft/villager
|
|
mymap:schrödingers_var |
mymap
|
|
mymap:schrödingers_varTemplate:Only
|
custom_pack:Capital |
custom_pack
|
|
custom_pack:CapitalTemplate:Only
|
Java Edition usage
- REDIRECT Template:Work in progress
in Template:Editions, identifiers act mainly as main keys of objects in registries or file paths of contents in data packs and resource packs. Some non-customizable contents also use identifiers to identify them.
Registries and registry objects
Template:Message boxTemplate:Article other
All registries and objects therein have identifiers to represent them. At the root of all registries is a registry with the identifier of
- REDIRECT Template:Code
Template:Redr into which all other registries are registered. Most registries are intended only for use internally by the game and by extension by mods, but some dynamic registries can have content added to them through data packs, marked in the list below with an asterisk (*).
- Template:File: Root registry.
- Template:File: Attributes.
- Template:File: Blocks.
- Template:File: Block entity types.
- Template:File: Chunk status.
- Template:File: Command argument types.
- Template:File*: Dimensions and level stems.
- Template:File*: Dimension types.
- Template:File*: Enchantments.
- Template:File: Entity types.
- Template:File: Fluids.
- Template:File: Game events.
- Template:File: Position source types (used by game events).
- Template:File: Items.
- Template:File*: Menu types.
- Template:File: Mob effects.
- Template:File: Particle types.
- Template:File: Potions.
- Template:File: Recipe serializers.
- Template:File: Recipe types.
- Template:File: Sound events.
- Template:File: Statistics types.
- Template:File: Custom Statistics.
- Template:File: World clocks.
- Template:File Timelines for world clocks.
- Template:File Entity data registries:
- Template:File: Entity schedule activitys.
- Template:File: Entity memory module types.
- Template:File: Entity schedules.
- Template:File: Entity AI sensor types.
- Template:File*: Painting motives.
- Template:File: Villager professions.
- Template:File: Villager types.
- Template:File: Villager trade definition.
- Template:File: Poi types.
- Template:File Loot table serializers:
- Template:File: Loot condition types.
- Template:File: Loot function types.
- Template:File: Loot nbt provider types.
- Template:File: Loot number provider types.
- Template:File: Loot pool entry types.
- Template:File: Loot score provider types.
- Template:File JSON file value providers:
- Template:File: Float provider types.
- Template:File: Int provider types.
- Template:File: Height provider types.
- Template:File World generator registries:
- Template:File: Block predicate types.
- Template:File: Structure feature rule test types.
- Template:File: Structure feature position rule test types.
- Template:File: World carvers.
- Template:File*: Configured world carvers.
- Template:File: Features.
- Template:File*: Configured features.
- Template:File: Structure sets.
- Template:File: Structure processor types.
- Template:File*: Structure processor lists.
- Template:File: Structure pool element types.
- Template:File*: Structure template pools.
- Template:File: Structure piece types.
- Template:File: Structure features.
- Template:File*: Configured structure features.
- Template:File: Structure placement types.
- Template:File: Placement modifier types.
- Template:File*: Placed features.
- Template:File*: Biomes.
- Template:File: Biome sources.
- Template:File*: Normal noise.
- Template:File*: Noise generator settings.
- Template:File: Density functions.
- Template:File: Density function types.
- Template:File: World presets.
- Template:File: Flat world generator presets.
- Template:File: Chunk generators.
- Template:File: Surface condition sources.
- Template:File: Surface rule sources.
- Template:File: Block state provider types.
- Template:File: Foliage placer types.
- Template:File: Trunk placer types.
- Template:File: Tree decorator types.
- Template:File: Feature size types.
Pack contents
Identifiers are also used to represent file paths in data packs or resource packs.
- Data pack
-
- Tags
- Advancements
- Recipes
- Predicates
- Loot tables
- Item modifier
- Functions
- Structure files
- Dimensions
- Dimension types
- World generator contents
- Biomes
- Configured carvers
- Configured features
- Configured structure features
- Placed features
- Structures
- Structure sets
- Processor lists
- Template pools
- Noise
- Noise generator settings
- Density functions
- Flat level generator presets
- World presets
- Resource pack
-
- Block state model definitions
- Models
- Textures
- Sounds
- Fonts
- Font resource files
- Particles
- Shaders
Locating contents in packs
Given that objects in resource packs and data packs are files, the identifiers are constructed from their path relative to the
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr folder.
Though the locations vary by object type and the pack type the object type belongs to, there is a pattern to follow. In general, the location is in the fashion of pack_type/namespace/object_type/name.suffix, where all the / (forward slash) symbol (may be part of object_type or name) is replaced by operating system-dependent directory separator.
Given the type of content we want to locate, we can find out the corresponding
- REDIRECT Template:Code
- REDIRECT Template:Code
Template:Redr, and
- REDIRECT Template:Code
Template:Redr. Then, we can substitute in and find out the final file location of the content.
Examples
| Identifier | Content Type |
Template:Redr !! Final Location |
|---|---|---|
Template:Redr || Texture ||
| ||
Template:Redr || Function ||
| ||
Template:Redr
Template:Redr) || Model ||
| ||
Template:Redr
Template:Redr) || Function Tag ||
| ||
Template:Redr || Advancement ||
|
Registered pack contents
A registried pack content refers to pack content that is registered into a registry when the pack is loaded. For a registried pack content, its identifier works as both main key of registry entry and path of its resource file.
List of registered pack contents
| Content Type | Registered into | Folder | Suffix |
|---|---|---|---|
| Dimensions |
| ||
| Dimension types |
| ||
| Configured carvers |
| ||
| Configured features |
| ||
| Configured structure features |
| ||
| Structure sets |
| ||
| Processor lists |
| ||
| Template pools |
| ||
| Placed features |
| ||
| Biomes |
| ||
| Noise |
| ||
| Noise generator settings |
| ||
| Density functions |
| ||
| Flat level generator presets |
| ||
| World presets |
|
Other contents
- Customizable contents
-
- Boss bars
- Command storages
- Hardcoded contents
-
- Cat types for predicates (e.g. textures/entity/cat/tabby.png, textures/entity/cat/jellie.png)
- Criteria triggers
- Item properties (i.e. item predicates in models. e.g. angle, custom_model_data)
- Loot context param sets (i.e. types of loot table. e.g. barter, generic)
- Unaccessible contents:
- Suggestion providers for autocompletion of commands (e.g. summonable_entities, all_recipes)
- Entity models
- Loot context params (e.g. this_entity, origin, tool)
Bedrock Edition usage
Unlike Java Edition, where there is a unified standard and handling methods of them, namespaced identifiers are usually treated as normal strings in Bedrock Edition. Moreover, some objects are identified based on their path (e.g. the identifier for recipes and trades) rather than what was defined in their file. In these cases, it is recommended that a folder named after the namespace is parented before the file at hand.<ref name="cooperative">Template:Citation</ref>
The following is a list of all places that use namespaced identifiers:
Built-in contents
- Blocks
- Block traits
- Block entities
- Items
- Entities
- Status effects
- Dimensions
- Biomes
- Structures
- Features
- Entity attributes
- Item NBT components
- Item components
- Block components
- Entity components
- JSON schemas
- GameTest script-enabled components
Registried add-on entries
A registried add-on entry refers to any add-on content that is registered with an identifier declared within the content's file definition. Custom content under these types are able to be created.
Here is a list of registried add-on entries whose identifiers are namespaced.
- Behavior pack contents
-
- Blocks
- Block states
- Entities
- Entity events
- Items
- Spawn rules
- Biomes
- Features
- Feature rules
- Recipes
- Structures
- GameTests
- Dialog scenes
- Spawn groups
- Structure sets
- Template pools
- Processor lists
- Catalog groups
- Resource pack contents
-
- Attachables
- Cameras
- Entity client definitions
- Particle effects
- Biome client definitions
- Fog settings
- Lighting settings
- Atmosphere settings
- Color grading settings
- Water effect settings
Some custom fields in add-on files can also be namespaced, such as custom block properties and entity component groups, which aren't listed here.
Others
- Structures saved from a structure block
Script-registered entries
Some content may also be registered within the scripts of behavior packs. These are read as the world is generating.
- Block components
- Item components
- Commands
Namespaces
"This isn't a new concept, but I thought I should reiterate what a "namespace" is. Most things in the game has a namespace, so that if we add
- REDIRECT Template:Code
Template:Redr and a mod (or map, or whatever) adds
- REDIRECT Template:Code
Template:Redr, they're both different
- REDIRECT Template:Code
Template:Redrs. Whenever you're asked to name something, for example a loot table, you're expected to also provide what namespace that thing comes from. If you don't specify the namespace, we default to
- REDIRECT Template:Code
Template:Redr. This means that
- REDIRECT Template:Code
Template:Redr and
- REDIRECT Template:Code
Template:Redr are the same thing.
A namespace is a domain for content. It is to prevent potential content conflicts or unintentional overrides of objects of the same name.
For example, two data packs add two minigame mechanisms to Minecraft; both have a function named
- REDIRECT Template:Code
Template:Redr. Without namespaces, these two functions would clash and the minigames would be broken. When they have different namespaces of
- REDIRECT Template:Code
Template:Redr and
- REDIRECT Template:Code
Template:Redr, the functions would become
- REDIRECT Template:Code
Template:Redr and
- REDIRECT Template:Code
Template:Redr, which no longer conflict.
===
- REDIRECT Template:Code
Template:Redr namespace === Minecraft reserves the
- REDIRECT Template:Code
Template:Redr namespace. When a namespace is not specified, an identifier falls back to
- REDIRECT Template:Code
Template:RedrTemplate:Only. As a result, the
- REDIRECT Template:Code
Template:Redr namespace should only be used by content creators when the content needs to overwrite or modify existing Minecraft data, such as adding a function to the
- REDIRECT Template:Code
Template:Redr function tag.
Custom namespace
The namespace should be distinct for different projects or content creations (e.g. a data pack, a resource pack, a mod, backing data/resource packs for a custom map, etc.)
To prevent potential clashes, it is recommended that the namespace should be as specific as possible:
- Avoid alphabet soups. For example, a project named "nuclear craft" should not use the namespace
- REDIRECT Template:Code
Template:Redr, as this is too ambiguous.
- Avoid words that are too vague.
- REDIRECT Template:Code
Template:Redr would not be informative to look up as well, but
- REDIRECT Template:Code
Template:Redr would be much better.
- For Minecraft:add-ons, use a shortened creator name followed by the name of the project in a format like
- REDIRECT Template:Code
Template:Redr.<ref name="cooperative"/>
In either case, these poorly chosen namespaces reduce the exposure of a project and bring difficulties for debugging when there are multiple content creations applied to the game.
Other built-in namespaces
in Template:Editions, the vanilla Minecraft resource pack declares Realms-oriented language files in the
- REDIRECT Template:Code
Template:Redr namespace (located at assets/realms/lang/.json) and game-related language files in the
- REDIRECT Template:Code
Template:Redr namespace, even though translation keys are not identifiers. The realms jar itself also declares its en_us.json language file and its various textures in the
- REDIRECT Template:Code
Template:Redr namespace.
In the IDs of command argument types, a
- REDIRECT Template:Code
Template:Redr namespace also appears for command argument types that are native to Brigadier.
in Template:Editions, the internal resource and behavior packs for Minecraft:Bedrock Editor contain some entities and items namespaced with editor.
History
Java Edition
Bedrock Edition
See also
- Java Edition data values
- Minecraft:Bedrock Edition data values
- Resource pack
- Data pack
- Minecraft:Add-on
References
<references group="">
</references>
External links
- Namespaces, as explained in Template:Snap.
| Editions |
| ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Development |
| ||||||||
| Technical |
| ||||||||
| Multiplayer | |||||||||
| Exclusive features |
| ||||||||
| Removed |
de:Namensraum es:Ubicación de recurso fr:Identifiant ja:識別子 ko:식별자 pt:Localização de recurso ru:Пространство имён идентификаторов uk:Простір імен ідентифікаторів zh:命名空间ID