Skip to content

Textures - Terrain Atlas

anvil.api.textures.terrain_atlas

The resource pack's textures/terrain_texture.json: the block atlas.

TerrainTexturesObject

Bases: JsonFile[_TerrainTextureFile]

The terrain atlas, textures/terrain_texture.json, which names the textures block material instances use. There is one per pack.

Documentation reference

identifier property

The file's identifier.

name property

The identifier's name, without its namespace.

__export__()

Writes the atlas, when it has any texture.

__init__()

Initializes a TerrainTexturesObject instance.

__new__()

Ensures only one instance of TerrainTexturesObject exists (singleton pattern).

__schema__() classmethod

The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with the file's type as title and where it is written under x-anvil-file.

Raises:

Type Description
TypeError

When the class is an abstract file base, with no document type.

add_block(block_name, directory, block_textures, force_vanilla=False)

Adds block textures.

Parameters:

Name Type Description Default
block_name str

The texture's short name, <namespace>:<block_name>.

required
directory str

The folder of the textures, inside the project's blocks folder.

required
block_textures list[str]

The texture names.

required
force_vanilla bool

Uses block_name as it is, as vanilla textures do. Defaults to False.

False

add_block_variations(block_name, directory, block_variant, force_vanilla=False)

Adds a block texture picked from weighted textures by the block's position.

Parameters:

Name Type Description Default
block_name str

The texture's short name, <namespace>:<block_name>.

required
directory str

The folder of the textures, inside the project's blocks folder.

required
block_variant list[tuple[str, float]]

Up to 256 (texture, weight) pairs, each weight from 0.05 to 1000000.

required
force_vanilla bool

Uses block_name as it is, as vanilla textures do. Defaults to False.

False

queue()

Queues the terrain atlas for export.