Functions

Loading the database

create_db(db_path: str = ':memory:') Connection[source]

Creates a new dtabase in db_path. Runs all of the build scripts of the database components.

Parameters

db_path – The path to the database file. The argument is passed to sqlite3.connect() If the argument is ":memory:", the database is created in memory. ":memory:" is the default value.

open_db(db_path: str) Connection[source]

Opens a database file. Usually these files are created by create_db(). This function doesn’t check if the database has a valid structure. It assumes it does. This function only opens the database and sets some sqlite3 adapter and converter functions for Path objects.

Parameters

db_path – The path to the database file. The argument is passed to sqlite3.connect().

Loading Resource Packs

DbRpItems

Possible values of include and :code:`exclude arguments of load_rp() function.

alias of Literal[‘geometries’, ‘client_entities’, ‘render_controllers’, ‘textures’, ‘particles’, ‘rp_animations’, ‘rp_animation_controllers’, ‘attachables’, ‘sound_definitions’, ‘sounds’]

load_rp(db: Connection, rp_path: Path, *, include: Iterable[Literal['geometries', 'client_entities', 'render_controllers', 'textures', 'particles', 'rp_animations', 'rp_animation_controllers', 'attachables', 'sound_definitions', 'sounds']] = ('geometries', 'client_entities', 'render_controllers', 'textures', 'particles', 'rp_animations', 'rp_animation_controllers', 'attachables', 'sound_definitions', 'sounds'), exclude: Iterable[Literal['geometries', 'client_entities', 'render_controllers', 'textures', 'particles', 'rp_animations', 'rp_animation_controllers', 'attachables', 'sound_definitions', 'sounds']] = ()) None[source]

Loads resource pack data into the database.

Parameters
  • db – The database connection.

  • rp_path – The path to the resource pack.

  • include – A list of items to include. By default, all items are included.

  • exclude – A list of items to exclude. By default, no items are excluded.

If there is an item in both include and exclude, it is excluded. The include and exclude lists accept strings that are the names of the supported database components.

Loading Behavior Packs

load_bp(db: Connection, bp_path: Path, include: Iterable[Literal['entities']] = ('entities',), exclude: Iterable[Literal['geometries', 'client_entities', 'render_controllers', 'textures', 'particles', 'rp_animations', 'rp_animation_controllers', 'attachables', 'sound_definitions', 'sounds']] = ()) None[source]

Loads behavior pack data into the database.

Parameters
  • db – The database connection.

  • bp_path – The path to the resource pack.

  • include – A list of items to include. By default, all items are included.

  • exclude – A list of items to exclude. By default, no items are excluded.

If there is an item in both include and exclude, it is excluded. The include and exclude lists accept strings that are the names of the supported database components.