Loading data

Loading the database

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’, ‘rp_items’]

DbBpItems

alias of Literal[‘entities’, ‘loot_tables’, ‘trade_tables’, ‘bp_animations’, ‘bp_animation_controllers’, ‘bp_items’]

class Database(connection)[source]

A class that represents a database with resource packs and behavior packs.

Parameters

connection (Connection) –

close()[source]

Runs close() function on the database connection.

commit()[source]

Runs commit() function on the database connection.

connection: Connection

The SQLite database conncetion.

static create(db_path=':memory:')[source]

Creates a new database for storing resource packs and behavior packs in memory or in a file. The default value is ":memory:" which means that the database is created in memory (just like in sqlite3).

Parameters

db_path (str | pathlib.Path) – The path to the database file or ":memory:".

Return type

Database

load_bp(bp_path, *, include=('entities', 'loot_tables', 'trade_tables', 'bp_animations', 'bp_animation_controllers', 'bp_items'), exclude=())[source]

Loads behavior pack data into the database.

Parameters
  • db – The database connection.

  • bp_path (Path) – The path to the resource pack.

  • include (Container[Literal['entities', 'loot_tables', 'trade_tables', 'bp_animations', 'bp_animation_controllers', 'bp_items']]) – A list of items to include. By default, all items are included.

  • exclude (Container[Literal['entities', 'loot_tables', 'trade_tables', 'bp_animations', 'bp_animation_controllers', 'bp_items']]) – A list of items to exclude. By default, no items are excluded.

Return type

None

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.

load_rp(rp_path, *, include=('geometries', 'client_entities', 'render_controllers', 'textures', 'particles', 'rp_animations', 'rp_animation_controllers', 'attachables', 'sound_definitions', 'sounds', 'rp_items'), exclude=())[source]

Loads resource pack data into the database.

Parameters
  • db – The database connection.

  • rp_path (Path) – The path to the resource pack.

  • include (Container[Literal['geometries', 'client_entities', 'render_controllers', 'textures', 'particles', 'rp_animations', 'rp_animation_controllers', 'attachables', 'sound_definitions', 'sounds', 'rp_items']]) – A list of items to include. By default, all items are included.

  • exclude (Container[Literal['geometries', 'client_entities', 'render_controllers', 'textures', 'particles', 'rp_animations', 'rp_animation_controllers', 'attachables', 'sound_definitions', 'sounds', 'rp_items']]) – A list of items to exclude. By default, no items are excluded.

Return type

None

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.

static open(db_path)[source]

Creates a database using path to the database file.

Parameters

db_path (str | pathlib.Path) – the path to the database file

Return type

Database