Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Adding Namespaces

To add new namespaces to your datapack you use the Namespace class and the add_namespaces method from the Datapack class.

my_namespace: Namespace = Namespace(name="my_namespace")

my_pack.add_namespaces(my_namespace)

Of course you can create multiple namespaces.

Whole code

from MCpypack import *

my_pack: Datapack = Datapack(
    name="My Datapack",
    description="My first datapack",
    version="26.1"
)

my_namespace: Namespace = Namespace(name="my_namespace")
my_pack.add_namespaces(my_namespace)

my_pack.export()