Skip to content

Textures - Item Atlas

anvil.api.textures.item_atlas

The resource pack's textures/item_texture.json: the item atlas.

ItemTexturesObject

Bases: JsonFile[_ItemTextureFile]

The item atlas, textures/item_texture.json, which names the textures item icons use. There is one per pack.

Documentation reference

identifier property

The file's identifier.

name property

The identifier's name, without its namespace.

__export__()

Copies the item sprites and writes the atlas, when it has any texture.

__init__()

Initializes a ItemTexturesObject instance.

__new__()

Ensures only one instance of ItemTexturesObject 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_item(item_name, blockbench=None, sprites=None)

add_item(item_name: str, sprites: list[str]) -> ItemTexturesObject
add_item(item_name: str, blockbench: str, sprites: list[str]) -> ItemTexturesObject

Adds item textures, from a Blockbench model or from assets/textures/items.

Parameters:

Name Type Description Default
item_name str

The name of the item.

required
blockbench str | list[str]

The Blockbench model name, or the sprites when there is no model.

None
sprites list[str]

The names of the item sprites.

None

Raises:

Type Description
FileNotFoundError

When a sprite has no .png in assets/textures/items.

queue()

Queues the item atlas for export.