amulet.api.registry.biome_manager module¶
- class amulet.api.registry.biome_manager.BiomeManager(biomes=())[source]¶
Bases:
BaseRegistryClass to handle the mappings between biome strings and their index-based internal IDs
- __contains__(item)[source]¶
Is the given biome string already in the registry.
>>> biome_string in level.biome_palette True >>> 7 in level.biome_palette True
- __iter__()[source]¶
Iterate through all biomes in the registry.
>>> for biome in level.biome_palette: >>> ...
- __getitem__(item)[source]¶
If a string is passed to this function, it will return the internal ID/index of the biome.
If an int is given, this method will return the biome string at that specified index.
>>> level.biome_palette[biome] 7 >>> level.biome_palette[7] biome
- Parameters
item – The string or int to get the mapping data of
- Returns
An int if a string was supplied, a string if an int was supplied
:raises KeyError if the requested item is not present.
- get_add_biome(biome)[source]¶
Adds a biome string to the internal biome string/ID mappings.
If the biome already exists in the mappings, the existing ID is returned.
- register(biome)[source]¶
An alias of
get_add_biome().Adds a biome string to the internal biome string/ID mappings.
If the biome already exists in the mappings, the existing ID is returned.