onyx.pack_manager

class onyx.pack_manager.DataPack(name, path=None, description=None, version=7)

DataPack - Class for creating data packs

Parameters
  • name (str) – The name of the data pack

  • path (str, optional) – The output path of the data pack. Defaults to None.

  • description (str, optional) – The description in pack.mcmeta. Defaults to None.

  • version (int, optional) – The pack format version. Defaults to 7.

generate(overwrite=True, zipped=False, only_generate_zip_object=False, print_output_path=True, print_generation_time=True)

generate - Generates the data pack

Parameters
  • overwrite (bool, optional) – Whether to overwrite the data pack if it already exists. Defaults to True.

  • zipped (bool, optional) – Whether to generate a zipped data pack. If False, a folder will be generated instead. Defaults to False.

  • only_generate_zip_object (bool, optional) – If set, only returns a ZipFile object instead of generating a file/folder. Defaults to False.

  • print_output_path (bool, optional) – Whether to print the output path of the data pack. Defaults to True.

  • print_generation_time (bool) – Whether the generation time should be printed to the console. Defaults to False.

Returns

A dictionary containing the output path of the data pack, the generation time, and the ZipFile object if only_generate_zip_object is True.

Return type

dict

advancement(path, contents)

advancement - Creates an advancement

Parameters
  • path (str) – The path of the advancement. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the advancement

Returns

An advancement object

Return type

Advancement

function(path, link, init=False, loop=False)

function - Creates a function. If link returns str, then that string is used as the function contents instead.

Parameters
  • path (str) – The path of the function. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • link (Union[Callable, str]) – (Union[Callable, str]): The python function to link to. All of the commands for this pack function should be in this python function. Alternatively, this function can return a string, or link can be a string itself, and that will be used as the function contents instead.

  • init (bool, optional) – Whether this function should be run when the pack is loaded. Defaults to False.

  • loop (bool, optional) – Whether this function should be run every tick. Defaults to False.

Returns

A function object

Return type

Function

item_modifier(path, contents)

item_modifier - Creates an item modifier

Parameters
  • path (str) – The path of the item modifier. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the item modifier

Returns

An item modifier object

Return type

ItemModifier

loot_table(path, contents)

loot_table - Creates a loot table

Parameters
  • path (str) – The path of the loot table. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the loot table

Returns

A loot table object

Return type

LootTable

predicate(path, contents)

predicate - Creates a predicate

Parameters
  • path (str) – The path of the predicate. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the predicate

Returns

A predicate object

Return type

Predicate

recipe(path, contents)

recipe - Creates a recipe

Parameters
  • path (str) – The path of the recipe. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the recipe

Returns

A recipe object

Return type

Recipe

structure(path, file_path)

structure - Creates a structure

Parameters
  • path (str) – The path of the structure. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • file_path (str) – The full file path to the structure file (.nbt file)

Returns

A structure object

Return type

Structure

block_tag(path, contents)

block_tag - Creates a block tag

Parameters
  • path (str) – The path of the block tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the block tag

Returns

A block tag object

Return type

BlockTag

entity_tag(path, contents)

entity_tag - Creates an entity tag

Parameters
  • path (str) – The path of the entity tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the entity tag

Returns

An entity tag object

Return type

EntityTag

fluid_tag(path, contents)

fluid_tag - Creates a fluid tag

Parameters
  • path (str) – The path of the fluid tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the fluid tag

Returns

A fluid tag object

Return type

FluidTag

function_tag(path, contents)

function_tag - Creates a function tag

Parameters
  • path (str) – The path of the function tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the function tag

Returns

A function tag object

Return type

FunctionTag

game_event_tag(path, contents)

game_event_tag - Creates a game event tag

Parameters
  • path (str) – The path of the game event tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the game event tag

Returns

A game event tag object

Return type

GameEventTag

item_tag(path, contents)

item_tag - Creates an item tag

Parameters
  • path (str) – The path of the item tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the item tag

Returns

An item tag object

Return type

ItemTag

dimension(path, contents)

dimension - Creates a dimension

Parameters
  • path (str) – The path of the dimension. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the dimension

Returns

A dimension object

Return type

Dimension

dimension_type(path, contents)

dimension_type - Creates a dimension type

Parameters
  • path (str) – The path of the dimension type. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the dimension type

Returns

A dimension type object

Return type

DimensionType

worldgen_biome(path, contents)

worldgen_biome - Creates a worldgen biome

Parameters
  • path (str) – The path of the worldgen biome. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen biome

Returns

A worldgen biome object

Return type

Worldgen_Biome

worldgen_configuredcarver(path, contents)

worldgen_configuredcarver - Creates a worldgen configured carver

Parameters
  • path (str) – The path of the worldgen configured carver. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen configured carver

Returns

A worldgen configured carver object

Return type

Worldgen_ConfiguredCarver

worldgen_configured_feature(path, contents)

worldgen_configured_feature - Creates a worldgen configured feature

Parameters
  • path (str) – The path of the worldgen configured feature. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen configured feature

Returns

A worldgen configured feature object

Return type

Worldgen_ConfiguredFeature

worldgen_configured_structure_feature(path, contents)

worldgen_configured_structure_feature - Creates a worldgen configured structure feature

Parameters
  • path (str) – The path of the worldgen configured structure feature. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen configured structure feature

Returns

A worldgen configured structure feature object

Return type

Worldgen_ConfiguredStructureFeature

worldgen_configured_surface_builder(path, contents)

worldgen_configured_surface_builder - Creates a worldgen configured surface builder

Parameters
  • path (str) – The path of the worldgen configured surface builder. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen configured surface builder

Returns

A worldgen configured surface builder object

Return type

Worldgen_ConfiguredSurfaceBuilder

worldgen_noise_settings(path, contents)

worldgen_noise_settings - Creates a worldgen noise settings

Parameters
  • path (str) – The path of the worldgen noise settings. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen noise settings

Returns

A worldgen noise settings object

Return type

Worldgen_NoiseSettings

worldgen_processor_list(path, contents)

worldgen_processor_list - Creates a worldgen processor list

Parameters
  • path (str) – The path of the worldgen processor list. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen processor list

Returns

A worldgen processor list object

Return type

Worldgen_ProcessorList

worldgen_template_pool(path, contents)

worldgen_template_pool - Creates a worldgen template pool

Parameters
  • path (str) – The path of the worldgen template pool. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen template pool

Returns

A worldgen template pool object

Return type

Worldgen_TemplatePool

class onyx.pack_manager.PackResource(path, parent_pack, beet_obj)

PackResource - Template class for all data pack objects. To get the contents, use PackResource.beet_obj.content.

Parameters
  • path (str) – The path of the resource. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • parent_pack (DataPack) – The data pack which the resource belongs to

  • beet_obj (beet.NamespaceFile) – A beet object coresponding to the pack resource

class onyx.pack_manager.Advancement(path, contents, parent_pack)

Advancement - A data pack advancement. Do not create manually. Instead, use the DataPack.advancement method.

Parameters
  • path (str) – The path of the advancement. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the advancement

  • parent_pack (DataPack) – The data pack which the advancement belongs to

class onyx.pack_manager.Function(path, link, is_init, is_loop, parent_pack)

Function - A data pack function. Do not create manually. Instead, use the DataPack.function method.

Parameters
  • path (str) – The path of the function. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • link (Union[Callable, str]) – The python function to link to. All of the commands for this pack function should be in this python function. Alternatively, this function can return a string, or link can be a string itself, and that will be used as the function contents instead.

  • is_init (bool) – Whether or not the function should be called when the data pack loads

  • is_loop (bool) – Whether or not the function should be called every tick

  • parent_pack (DataPack) – The parent pack object

add(commands)

add - Adds commands to the function

Parameters

commands (list) – The commands to add

Return type

None

send_object_to_parent_pack()

send_object_to_parent_pack - Sends the function to the parent pack. You can call this manually to force update the function if you change the contents after generation.

Return type

None

class onyx.pack_manager.ItemModifier(path, contents, parent_pack)

ItemModifier - A data pack advancement. Do not create manually. Instead, use the DataPack.item_modifier method.

Parameters
  • path (str) – The path of the item modifier. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the item modifier

  • parent_pack (DataPack) – The data pack which the item modifier belongs to

class onyx.pack_manager.LootTable(path, contents, parent_pack)

LootTable - A data pack loot table. Do not create manually. Instead, use the DataPack.loot_table method.

Parameters
  • path (str) – The path of the loot table. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the loot table

  • parent_pack (DataPack) – The data pack which the loot table belongs to

class onyx.pack_manager.Predicate(path, contents, parent_pack)

Predicate - A data pack predicate. Do not create manually. Instead, use the DataPack.predicate method.

Parameters
  • path (str) – The path of the predicate. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the predicate

  • parent_pack (DataPack) – The data pack which the predicate belongs to

class onyx.pack_manager.Recipe(path, contents, parent_pack)

Recipe - A data pack recipe. Do not create manually. Instead, use the DataPack.recipe method.

Parameters
  • path (str) – The path of the recipe. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the recipe

  • parent_pack (DataPack) – The data pack which the recipe belongs to

class onyx.pack_manager.Structure(path, file_path, parent_pack)

Structure - A data pack structure. Do not create manually. Instead, use the DataPack.structure method.

Parameters
  • path (str) – The path of the structure. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • file_path (str) – The full file path to the structure file (.nbt file)

  • parent_pack (DataPack) – The data pack which the structure belongs to

class onyx.pack_manager.BlockTag(path, contents, parent_pack)

BlockTag - A data pack block tag. Do not create manually. Instead, use the DataPack.block_tag method.

Parameters
  • path (str) – The path of the block tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the block tag

  • parent_pack (DataPack) – The data pack which the block tag belongs to

class onyx.pack_manager.EntityTag(path, contents, parent_pack)

EntityTag - A data pack entity tag. Do not create manually. Instead, use the DataPack.entity_tag method.

Parameters
  • path (str) – The path of the entity tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the entity tag

  • parent_pack (DataPack) – The data pack which the entity tag belongs to

class onyx.pack_manager.FluidTag(path, contents, parent_pack)

FluidTag - A data pack fluid tag. Do not create manually. Instead, use the DataPack.fluid_tag method.

Parameters
  • path (str) – The path of the fluid tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the fluid tag

  • parent_pack (DataPack) – The data pack which the fluid tag belongs to

class onyx.pack_manager.FunctionTag(path, contents, parent_pack)

FunctionTag - A data pack function tag. Do not create manually. Instead, use the DataPack.function_tag method.

Parameters
  • path (str) – The path of the function tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the function tag

  • parent_pack (DataPack) – The data pack which the function tag belongs to

class onyx.pack_manager.GameEventTag(path, contents, parent_pack)

GameEventTag - A data pack game event tag. Do not create manually. Instead, use the DataPack.game_event_tag method.

Parameters
  • path (str) – The path of the game event tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the game event tag

  • parent_pack (DataPack) – The data pack which the game event tag belongs to

class onyx.pack_manager.ItemTag(path, contents, parent_pack)

ItemTag - A data pack item tag. Do not create manually. Instead, use the DataPack.item_tag method.

Parameters
  • path (str) – The path of the item tag. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the item tag

  • parent_pack (DataPack) – The data pack which the item tag belongs to

class onyx.pack_manager.Dimension(path, contents, parent_pack)

Dimension - A data pack dimension. Do not create manually. Instead, use the DataPack.dimension method.

Parameters
  • path (str) – The path of the dimension. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the dimension

  • parent_pack (DataPack) – The data pack which the dimension belongs to

class onyx.pack_manager.DimensionType(path, contents, parent_pack)

DimensionType - A data pack dimension type. Do not create manually. Instead, use the DataPack.dimension_type method.

Parameters
  • path (str) – The path of the dimension type. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the dimension type

  • parent_pack (DataPack) – The data pack which the dimension type belongs to

class onyx.pack_manager.Worldgen_Biome(path, contents, parent_pack)

Worldgen_Biome - A data pack worldgen biome. Do not create manually. Instead, use the DataPack.worldgen_biome method.

Parameters
  • path (str) – The path of the worldgen biome. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen biome

  • parent_pack (DataPack) – The data pack which the worldgen biome belongs to

class onyx.pack_manager.Worldgen_ConfiguredCarver(path, contents, parent_pack)

Worldgen_ConfiguredCarver - A data pack worldgen configured carver. Do not create manually. Instead, use the DataPack.worldgen_configured_carver method.

Parameters
  • path (str) – The path of the worldgen configured carver. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen configured carver

  • parent_pack (DataPack) – The data pack which the worldgen configured carver belongs to

class onyx.pack_manager.Worldgen_ConfiguredFeature(path, contents, parent_pack)

Worldgen_ConfiguredFeature - A data pack worldgen configured feature. Do not create manually. Instead, use the DataPack.worldgen_configured_feature method.

Parameters
  • path (str) – The path of the worldgen configured feature. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen configured feature

  • parent_pack (DataPack) – The data pack which the worldgen configured feature belongs to

class onyx.pack_manager.Worldgen_ConfiguredStructureFeature(path, contents, parent_pack)

Worldgen_ConfiguredStructureFeature - A data pack worldgen configured structure feature. Do not create manually. Instead, use the DataPack.worldgen_configured_structure_feature method.

Parameters
  • path (str) – The path of the worldgen configured structure feature. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen configured structure feature

  • parent_pack (DataPack) – The data pack which the worldgen configured structure feature belongs to

class onyx.pack_manager.Worldgen_ConfiguredSurfaceBuilder(path, contents, parent_pack)

Worldgen_ConfiguredSurfaceBuilder - A data pack worldgen configured surface builder. Do not create manually. Instead, use the DataPack.worldgen_configured_surface_builder method.

Parameters
  • path (str) – The path of the worldgen configured surface builder. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen configured surface builder

  • parent_pack (DataPack) – The data pack which the worldgen configured surface builder belongs to

class onyx.pack_manager.Worldgen_NoiseSettings(path, contents, parent_pack)

Worldgen_NoiseSettings - A data pack worldgen noise settings. Do not create manually. Instead, use the DataPack.worldgen_noise_settings method.

Parameters
  • path (str) – The path of the worldgen noise settings. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen noise settings

  • parent_pack (DataPack) – The data pack which the worldgen noise settings belongs to

class onyx.pack_manager.Worldgen_ProcessorList(path, contents, parent_pack)

Worldgen_ProcessorList - A data pack worldgen processor list. Do not create manually. Instead, use the DataPack.worldgen_processor_list method.

Parameters
  • path (str) – The path of the worldgen processor list. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen processor list

  • parent_pack (DataPack) – The data pack which the worldgen processor list belongs to

class onyx.pack_manager.Worldgen_TemplatePool(path, contents, parent_pack)

Worldgen_TemplatePool - A data pack worldgen template pool. Do not create manually. Instead, use the DataPack.worldgen_template_pool method.

Parameters
  • path (str) – The path of the worldgen template pool. Given as namespace:path/to/file, or path/to/file. If no namespace is specified, then the snake case format of the data pack name will be used.

  • contents (dict) – The contents of the worldgen template pool

  • parent_pack (DataPack) – The data pack which the worldgen template pool belongs to