Loading data
Loading the database
- DbRpItems
alias of
Literal[‘geometries’, ‘client_entities’, ‘render_controllers’, ‘textures’, ‘particles’, ‘rp_animations’, ‘rp_animation_controllers’, ‘attachables’, ‘sound_definitions’, ‘sounds’, ‘rp_items’, ‘terrain_texture’]
- DbBpItems
alias of
Literal[‘entities’, ‘loot_tables’, ‘trade_tables’, ‘bp_animations’, ‘bp_animation_controllers’, ‘bp_items’, ‘bp_blocks’]
- class Database(connection)[source]
A class that represents a database with resource packs and behavior packs.
- Parameters
connection (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 (Union[str, Path]) – The path to the database file or
":memory:".- Return type
- load_bp(bp_path, *, include=('entities', 'loot_tables', 'trade_tables', 'bp_animations', 'bp_animation_controllers', 'bp_items', 'bp_blocks'), 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', 'bp_blocks']]) – 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', 'bp_blocks']]) – 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', 'terrain_texture'), 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', 'terrain_texture']]) – 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', 'terrain_texture']]) – 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. 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 (Union[str, Path]) – the path to the database file
- Return type