Resource location

Resource locationsOfficially named resource location . However, this name isn't used . (also known as namespaced IDs, namespaced identifiers, resource identifiers, or namespaced stringsDataFixerUpper/NamespacedStringType.java at 8b5f82ab78b30ff5813b3a7f3906cd3f4f732acf · Mojang/DataFixerUpper – GitHub) 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 ==
Resource locations are used as plain strings to reference blocks, items, entity types, and various other objects in vanilla Minecraft.
A valid resource location has a format of namespace:path, where only certain characters can be used.
=== Legal characters ===
==== Java Edition ====
The namespace and the path of a resource location should only contain the following symbols:
* 0123456789 Numbers
* abcdefghijklmnopqrstuvwxyz Lowercase 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 an 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 ===
A resource location would be converted to a string by appending 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 ===
Unlike that, resource locations can always be converted to strings; some strings cannot be converted to resource locations.
A few restrictions:
* The string can have at most one : (colon) character
* The rest of the string must fulfill the requirement for legal characters
When the : is present, the part of the string before the : becomes the namespace, and that after the : becomes the path.
, and in some cases , 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 resource locations.
;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 	minecraftNone 	diamond 	minecraft:diamonddiamond
foo/bar:coal 	Invalid character /	 	
minecraft/villager 	minecraftNone 	minecraft/villager 	minecraft:minecraft/villagerminecraft/villager
mypack_recipe 	minecraftNone 	mypack_recipe 	minecraft:mypack_recipemypack_recipe
mymap:schrödingers_var	mymap 	Invalid character öschrödingers_var	mymap:schrödingers_var
custom_pack:Capital 	custom_pack 	Invalid character CCapital 	custom_pack:Capital
== Usage ==
Here list all places that use resource locations: 
===Java Edition===
, resource locations act mainly as main keys of objects in registries, or file paths of contents in packs. Besides, some customizable or hardcoded contents also use resource locations.
==== Registries and registry objects ====
Each registry and each object in registries has a resource location to represent it.
There's a root registry with resource location of . Other registries are registered into the root registry as its entries.
The following is the list of registries and their resource locations:
; Root Registry：
:* Attribute: 
:* Block: 
:* Block entity type: 
:* Chunk status: 
:* Command argument type: 
:* Dimension and Level stem: 
:* Dimension type: 
:* Enchantment: 
:* Entity type: 
:* Fluid: 
:* Game event: 
:* Position source type (used by game events): 
:* Item: 
:* Menu type: 
:* Mob effect: 
:* Particle type: 
:* Potion: 
:* Recipe serializer: 
:* Recipe type: 
:* Sound event: 
:* Statistics type: 
:* Custom Statistics: 
:* Entity data registries
:** Entity schedule activity: 
:** Entity memory module type: 
:** Entity schedule: 
:** Entity AI sensor type: 
:** Painting motive: 
:** Villager profession: 
:** Villager type: 
:** Poi type: 
:* Loot table serializer registries:
:** Loot condition type: 
:** Loot function type: 
:** Loot nbt provider type: 
:** Loot number provider type: 
:** Loot pool entry type: 
:** Loot score provider type: 
:* Json file value provider registries:
:** Float provider type: 
:** Int provider type: 
:** Height provider type: 
:* World generator registries:
:** Block predicate type: 
:** Structure featrue rule test type: 
:** Structure featrue position rule test type: 
:** World carver: 
:** Configured world carver: 
:** Feature: 
:** Configured feature: 
:** Structure set: 
:** Structure processor type: 
:** Structure processor list: 
:** Structure pool element type: 
:** Structure template pool: 
:** Structure piece type: 
:** Structure feature: 
:** Configured structure feature: 
:** Structure placement type: 
:** Placement modifier type: 
:** Placed feature: 
:** Biome: 
:** Biome source: 
:** Normal noise: 
:** Noise generator settings: 
:** Density function: 
:** Density function type: 
:** World preset: 
:** Flat world generator preset: 
:** Chunk generator: 
:** Surface condition source: 
:** Surface rule source: 
:** Block state provider type: 
:** Foliage placer type: 
:** Trunk placer type: 
:** Tree decorator type: 
:** Feature size type: 
====Pack contents====
Resource locations are also used to represent files' paths in data pack or resource pack.
; 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 states
:* Models
:* Textures
:* Sounds
:* Fonts
:* Font resource files
:* Particles
:* shaders
===== Locating contents in packs =====
Given objects from resource packs and data packs are files, the resource locations represent corresponding paths.
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 , , and . Then, we can substitute in and find out the final file location of the content.
Examples
Resource location	Content Type				Final Location
 	Texture 				
 	Function 				
(same as ) 	Model 				
(same as ) 	Function Tag				
 	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 resource location 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===
Unlike Java Edition, where there is a unified standard and handling methods of resource location, namespaced identifiers are usually treated as normal strings in Bedrock Edition. Moreover, namespaced identifiers are even not required in some cases (e.g. recipe's identifier). However, for content creators, it is recommended to always use namespaced identifiers no matter whether required or not.
The following is a list of all places that use namespaced identifiers: 
==== Build-in contents ====
:* Vanilla blocks, items, entities, status effects, dimensions, biomes, structures, features, etc.
:* Entity attributes
:* Item components for commands
:* Components for block, entity, etc. used in add-on files
:* Json schemas for addons
:* Gametest script enabled components
====Registried add-on entries====
A registried add-on entry refers to add-on content that is registered with an identifier which is declared in add-on files.
Here is a list of registried add-on entries whose identifiers can be namespaced.
; Behavior pack contents
:* Blocks
:* Entities
:* Items
:* Spawn rules
:* Biomes
:* Features
:* Feature rules
:* Volumes
:* Recipes
:* Structures
:* Gametests
:* Diolog scenes
:* Spawn groups
; Resource pack contents
:* Attachables
:* Cameras
:* Particle effects
:* Fog 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 with structure block
== Namespaces ==
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 . Without namespaces, these two functions would clash and the minigames would be broken. When they have different namespaces of and , the functions would become and , which no longer conflict.
=== namespace ===
Minecraft reserves the namespace. When a namespace is not specified, a resource location falls back to . As a result, the 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 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, the namespace should be as specific as possible.
* Avoid alphabet soups. For example, a project named "nuclear craft" should not use the namespace , as this is too ambiguous.
* Avoid words that are too vague. would not be informative to look up as well, but would be much better.
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 ===
The vanilla Minecraft resource pack declares Realms-oriented language files in the namespace (located at assets/realms/lang/.json) and game-related language files in the namespace, even though translation keys are not resource locations. The realms jar itself also declares its en_us.json language file and its various textures in the namespace.
In the IDs of command argument types, a namespace also appears for command argument types that are native to Brigadier.
== History ==
== See also ==
* Java Edition data values
* Resource pack
* Data pack
== References ==
== External links ==
* Namespaces, as explained in .
de:Namensraum
es:ID de objetos
ja:名前空間ID
ko:리소스 위치
pt:ID de espaço de nome
ru:Пространство имён идентификаторов
uk:Ідентифікатор простору імен
zh:命名空间ID