Skip to content

Datapacks, Namespaces and File Structure

RedSponge edited this page Sep 22, 2018 · 3 revisions

Datapacks

What are datapacks?

Datapacks are a feature added to Minecraft in version 1.13 which allows the user to create their own advancements, crafting and cooking recipes, structures, tags, loot tables and functions, put them all into a folder or a zip archive and add them to a world.

The MCFunctionAPI (as the name suggests) helps you mainly in creating function files, which are files with the .mcfunction extension which contain a list of commands. they can then be run in the Minecraft client by using the function command.

Namespaces

What are namespaces?

Namespaces are like sub-folders of your main datapack, each one contains its own functions, advancements etc.. When calling a function in game using the function command, you need to supply the function name, as well as its namespace in the format namespace:function_name.

For example, lets say we have a function called create_entities which is in the namespace called util. To call it, you'll use the command /function util:create_entities

File Structure

The file structure of a datapack looks like this:

packname
    │   pack.mcmeta
    │
    └───data
        └───namespace_1
            ├───advancements
            │       advancement_1.json
            │       advancement_2.json
            │
            ├───functions
            │       func_1.mcfunction
            │       func_2.mcfunction
            │
            ├───loot_tables
            ├───recipes
            │       recipe_1.json
            │
            ├───structures
            └───tags
                ├───blocks
                ├───functions
                └───items

Clone this wiki locally