version_definitions module

class version_definitions.definition_manager.DefinitionManager(definitions_to_build)[source]

Bases: object

Handles loading block definitions and mapping them to our internal definitions

get_block_from_definition(block, default=None)[source]

Returns the internal name of the supplied versioned block

Parameters:
  • block (Union[str, list, tuple]) – The versioned block
  • default – The default value to return if missing
Return type:

str

Returns:

The internal name that is mapped to the versioned block

get_internal_block(resource_location='minecraft', basename='air', properties=None)[source]

Returns the versioned definition for the supplied internal block. Internal definitions are loosely based off of the flattened blockstates of Java Edition 1.13

Parameters:
  • resource_location – The resource location to look in
  • basename – The basename of the block
  • properties – The properties of the blockstate
Return type:

dict

Returns:

A dictionary representing the versioned definition of the internal block

static properties_to_string(props)[source]

Converts a dictionary of blockstate properties to a string

Parameters:props (dict) – The dictionary of blockstate properties
Return type:str
Returns:The string version of the supplied blockstate properties
static string_to_properties(string)[source]

Converts a string into a dictionary of blockstate properties

Parameters:string (str) – The string of blockstate properties
Return type:dict
Returns:The resulting dictionary of blockstate properties