Namespaces
Namespace: A namespace is a boundary for content. It is used to prevent potential content conflicts or accidentally overwriting objects with the same name.
For instance, if two data packs each have a function named "start," adding both of these data packs to the game without namespaces would lead to conflicts. By giving them distinct namespaces like "one" and "two," the functions become "one:start" and "two:start," resolving the conflict.
Minecraft Namespace: The game itself uses the "minecraft" namespace. If no namespace is specified, it defaults to "minecraft" (Java Edition only). The "minecraft" namespace should be used when projects need to override or modify existing "minecraft" data or add content to the original tags. An example would be adding a function to the minecraft:load function tag.
Custom Namespace: For different projects or content creations like data packs, resource packs, mods, etc., namespaces should be distinct. Only use the same namespace as another project if you need to override other projects or append tags.
To avoid potential conflicts, namespaces should be as specific as possible. Avoid using combinations of letters. For instance, a project named "nuclear craft" should not use the "nc" namespace, as it is too simple. Avoid using overly vague terms. "battle_royale" might not provide easy-to-find information, but "player_name_battle_royale" would be better.
Improper namespaces can make projects less adaptable and complicate debugging when adding multiple projects to the game.
Other Built-in Namespaces: While localization key names don't use namespace IDs, the game's default resource pack declares the "realms" namespace to store language files specifically for Realms (located in assets/realms/lang/<language_code>.json). The "minecraft" namespace stores language files related to the game itself. The Realm's jar file also declares its en_us.json language file and various textures within the "realms" namespace.
In command parameter types, there is also a "brigadier" namespace present in "brigadier."
Last updated