Blocks - Components Module
anvil.api.blocks.components
BlockBox
Bases: JsonObject
A box inside the block, in pixels, measured from the bottom centre of the block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
origin
|
tuple[float, float, float]
|
The minimal corner, x and z from -8 to 8, y from 0. |
required |
size
|
tuple[float, float, float]
|
The size along each axis. |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockChestObstruction
Bases: JsonComponent
Defines how this block obstructs a chest directly below it from opening.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obstruction_rule
|
BlockChestObstructionRule
|
"always", "never", or "shape" to use the block's shape. Game default "shape". |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockCollisionBox
Bases: _BlockBoxComponent
The area of the block that collides with entities. With no box, the full block collides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
origin
|
tuple[float, float, float]
|
The minimal corner of the box, in pixels from the bottom centre of the block. |
required |
size
|
tuple[float, float, float]
|
The size of the box. The box must stay within (-8, 0, -8) and (8, 24, 8). |
required |
enabled
|
bool
|
False makes the block collide with nothing, written as |
required |
Add more boxes with add_box. Boxes are always written as a list, even when there is only one.
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
add_box(*, origin, size)
Adds another collision box, for more complex shapes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
origin
|
tuple[float, float, float]
|
The minimal corner of the box. |
required |
size
|
tuple[float, float, float]
|
The size of the box. |
required |
BlockConnectionRule
Bases: JsonComponent
Defines whether fences, walls, bars and glass panes can connect to this block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
accepts_connections_from
|
BlockConnectionSource
|
"all", "only_fences" or "none". Game default "all". |
required |
enabled_directions
|
list[BlockFaceValues]
|
The sides that can connect. Game default every side. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockCraftingTable
Bases: JsonComponent
Makes the block a crafting table: it opens the crafting table UI and crafts the recipes with its tags.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crafting_tags
|
list[str]
|
The tags of the recipes it crafts, at most 64, each at most 64 characters. |
required |
table_name
|
str
|
The name shown on the UI. Anvil adds it to the language file under a key made from the block identifier. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Adds the name to the language file under tile.<identifier>.table_name for the root,
and tile.<identifier>.<name>.table_name for a permutation, then writes the key.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockCustomComponent
Bases: JsonCustomComponent
Base of block custom components: components registered by a script, with parameters.
Subclass it with an identifier and the parameters as fields. The identifier is in the project
namespace: a name without one gets it, any other namespace is refused.
class Explosive(BlockCustomComponent):
identifier = "explosive"
power: float = json_field()
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockDestructibleByExplosion
Bases: _Switchable
Describes how the block resists explosions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
explosion_resistance
|
float
|
The resistance to explosions. Game default 0. |
required |
enabled
|
bool
|
False makes the block indestructible by explosions, written as |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockDestructibleByMining
Bases: _Switchable
Describes how long the block takes to mine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seconds_to_destroy
|
float
|
The seconds to mine the block with base equipment. Game default 0. |
required |
item_specific_speeds
|
list[ItemSpecificSpeed]
|
The seconds to mine it with specific items. Set them directly or add them with |
required |
enabled
|
bool
|
False makes the block indestructible by mining, written as |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
add_item_specific_speed(*, item, destroy_speed)
Adds the seconds to mine the block with an item, or items with tags.
Example
mining.add_item_specific_speed( ... item=ItemTagFilter(tags=Query.AllTags(["minecraft:is_axe"])), destroy_speed=1.5 ... )
BlockDestructionParticles
Bases: JsonComponent
Sets the particles shown when the block is destroyed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
texture
|
str
|
The texture of the particles. |
required |
particle_count
|
int
|
How many particles, at most 255. Game default 100. |
required |
tint_method
|
TintMethod
|
Tint multiplied to the texture. |
required |
blockbench
|
str
|
The Blockbench model to take the texture from. Not written to the JSON. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockDisplayName
Bases: JsonValueComponent
Sets the name of the block. Anvil adds it to the language file under a key made from the block identifier, and writes the key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The name. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Adds the name to the language file under tile.<identifier>.name for the root, and
tile.<identifier>.<name>.name for a permutation, then writes the key in its place.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockEmbeddedVisual
Bases: _BlockVisual
The geometry and material instances used to render the block when it is embedded in another block, such as a flower in a flower pot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blockbench
|
str | Geometry
|
The Blockbench model, or a Geometry built in code. Defaults to the full block. |
required |
collection
|
str
|
The exported Blockbench collection to use. |
required |
n_way_visual_rotation
|
NWayVisualRotation
|
The states that turn the geometry. |
required |
Add material instances with add_material_instance, and bone visibility with
add_bone_visibility.
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
add_bone_visibility(**bones)
Sets which bones are visible. Custom geometries only.
Example
BlockItemVisual(blockbench="door").add_bone_visibility(door_open=False)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**bones
|
bool | Molang
|
Each bone name, and True, False or a Molang expression. |
{}
|
add_material_instance(*, blockbench, texture, face=BlockFaceValues.All, render_method=None)
Adds a material instance, and its texture to the resource pack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blockbench
|
str
|
The Blockbench model the texture comes from. |
required |
texture
|
str
|
The texture. |
required |
face
|
BlockFaceValues | str
|
The face, or a material instance name. Defaults to every face. |
All
|
render_method
|
BlockMaterial
|
The render method. Game default opaque. |
None
|
BlockEntity
Bases: JsonComponent
Gives each placed block its own data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
container
|
BlockEntityContainer
|
An inventory. Set it with |
required |
dynamic_properties
|
bool
|
Whether scripts can store dynamic properties on the block. Game default false. |
required |
entity_storage
|
bool
|
Whether scripts can store serialized entities in the block. Experimental: needs |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Adds the container title to the language file under
tile.<identifier>.container_title for the root, and
tile.<identifier>.<name>.container_title for a permutation, then writes the key.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
set_container(*, slot_count, title=None)
Gives the block an inventory. See BlockEntityContainer for the parameters.
BlockEntityContainer
Bases: JsonObject
The inventory of a block entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot_count
|
int
|
The number of slots, from 1 to 54. |
required |
title
|
str
|
[EXPERIMENTAL] The title shown on the container, 1 to 256 characters. Anvil adds it to the language file under a key made from the block identifier. Leaving it out leaves the heading blank. Needs |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockEntityFallOn
Bases: JsonComponent
Sets how far an entity must fall onto the block to trigger the onEntityFallOn event of its custom components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
minimum_fall_distance
|
float
|
The distance, in blocks. Game default 1. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockFlammable
Bases: _Switchable
Describes how the block catches fire from its neighbours.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catch_chance_modifier
|
int
|
The chance the block catches fire. Game default 5. |
required |
destroy_chance_modifier
|
int
|
The chance the fire destroys the block. Game default 20. |
required |
lava_flammable
|
BlockLavaFlammable
|
Whether lava next to the block sets it on fire: "always" or "never". |
required |
enabled
|
bool
|
False keeps fire from spreading to the block, written as |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockFlowerPottable
Bases: JsonComponent
The block can be placed in a flower pot. Root components only.
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockFriction
Bases: JsonValueComponent
How slippery the block is, from 0.0 to 0.9. Higher is less slippery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
The friction. Defaults to 0.4, ice uses 0.02. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockGeometry
Bases: JsonComponent
The geometry used to render the block. The block also needs BlockMaterialInstance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blockbench
|
str | Geometry | BlockDefaultGeometry
|
The Blockbench model of the block, a Geometry built in code, or a vanilla geometry. Defaults to "minecraft:geometry.full_block". Written as |
required |
collection
|
str
|
The exported Blockbench collection to use. The geometry identifier becomes |
required |
culling_layer
|
BlockCullingLayer
|
The culling layer. Game default "minecraft:culling_layer.undefined". |
required |
culling_shape
|
str
|
The shape used to cull neighbouring faces, such as "minecraft:unit_cube". Set by |
required |
n_way_visual_rotation
|
NWayVisualRotation
|
The block states that turn the geometry around each axis, for example |
required |
uv_lock
|
bool | list[str]
|
Locks the UV orientation of every bone, or of the bones named. |
required |
Set which bones are visible with add_bone_visibility.
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
add_bone_visibility(**bones)
Sets which bones are visible. Custom geometries only.
Example
BlockGeometry(blockbench="door").add_bone_visibility( ... door_open=Query.BlockState("open"), door_closed=~Query.BlockState("open") ... )
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**bones
|
bool | Molang
|
Each bone name, and True, False or a Molang expression. |
{}
|
block_culling(*, culling_shape='empty')
Gives the geometry culling rules, and returns them to add rules to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
culling_shape
|
empty | custom | VoxelShape
|
"custom" uses the bounding boxes of the Blockbench model; a VoxelShape is used as is. Defaults to "empty". |
'empty'
|
set_n_way_visual_rotation(*, x=None, y=None, z=None)
Sets the block states that turn the geometry around each axis. See NWayVisualRotation for the parameters.
BlockInstrumentSound
Bases: JsonComponent
Sets the sound a note block plays when it is above or below this block. At least one face is needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
up
|
InstrumentSound
|
The sound when the note block is above. Game default "note.harp". |
required |
down
|
InstrumentSound
|
The sound when the note block is below. Game default "note.none". |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
BlockItemVisual
Bases: _BlockVisual
The geometry and material instances used to render the block's item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blockbench
|
str | Geometry
|
The Blockbench model, or a Geometry built in code. Defaults to the full block. |
required |
collection
|
str
|
The exported Blockbench collection to use. |
required |
n_way_visual_rotation
|
NWayVisualRotation
|
The states that turn the geometry. |
required |
Add material instances with add_material_instance, and bone visibility with
add_bone_visibility.
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
add_bone_visibility(**bones)
Sets which bones are visible. Custom geometries only.
Example
BlockItemVisual(blockbench="door").add_bone_visibility(door_open=False)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**bones
|
bool | Molang
|
Each bone name, and True, False or a Molang expression. |
{}
|
add_material_instance(*, blockbench, texture, face=BlockFaceValues.All, render_method=None)
Adds a material instance, and its texture to the resource pack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blockbench
|
str
|
The Blockbench model the texture comes from. |
required |
texture
|
str
|
The texture. |
required |
face
|
BlockFaceValues | str
|
The face, or a material instance name. Defaults to every face. |
All
|
render_method
|
BlockMaterial
|
The render method. Game default opaque. |
None
|
item_display_transforms(*, merge=False, thirdperson_righthand=None, thirdperson_lefthand=None, firstperson_righthand=None, firstperson_lefthand=None, gui=None, head=None, ground=None, fixed=None)
Overrides the item_display_transforms the Blockbench model brings with it.
Only works on a visual made from a Blockbench collection, e.g.
BlockItemVisual(blockbench="oak_planks", collection="stairs"): the transforms live
in that collection's geometry file, so every block that uses the same collection
shares them.
Example
BlockItemVisual(blockbench="planks", collection="stairs").item_display_transforms( ... gui=ItemDisplayGuiTransform(rotation=(30, 225, 0), scale=(0.6, 0.6, 0.6)), ... ground=ItemDisplayTransform(translation=(0, 3, 0), scale=(0.5, 0.5, 0.5)), ... )
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
merge
|
bool
|
Keep the model's transforms for the slots not given. By default the model's transforms are dropped and only the ones given are used. |
False
|
thirdperson_righthand
|
ItemDisplayTransform
|
The transform of the |
None
|
thirdperson_lefthand
|
ItemDisplayTransform
|
The transform of the |
None
|
firstperson_righthand
|
ItemDisplayTransform
|
The transform of the |
None
|
firstperson_lefthand
|
ItemDisplayTransform
|
The transform of the |
None
|
head
|
ItemDisplayTransform
|
The transform of the |
None
|
ground
|
ItemDisplayTransform
|
The transform of the |
None
|
fixed
|
ItemDisplayTransform
|
The transform of the |
None
|
gui
|
ItemDisplayGuiTransform
|
The transform of the |
None
|
BlockLeashable
Bases: JsonComponent
The block can be leashed to by a lead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offset
|
tuple[float, float, float]
|
Where the lead attaches, in pixels. Game default (0, 8, 0). |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockLightDampening
Bases: JsonValueComponent
How much light is dampened as it passes through the block, from 0 to 15.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
15 is fully opaque, like stone; 0 is fully transparent, like glass. Defaults to 15. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockLightEmission
Bases: JsonValueComponent
How much light the block emits, from 0 to 15.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
The light level. Defaults to 0. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockLiquidDetection
Bases: JsonComponent
How the block reacts to liquids. Only one rule per liquid is used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
detection_rules
|
list[LiquidDetectionRule]
|
The rules, at least one. Set them directly or add them with |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
add_detection_rule(*, liquid_type=None, on_liquid_touches=None, can_contain_liquid=None, stops_liquid_flowing_from_direction=None, use_liquid_clipping=None)
Adds a rule. See LiquidDetectionRule for the parameters.
BlockLootTable
Bases: JsonValueComponent
The loot table the block drops when broken. Without it, the block drops itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
LootTable | str
|
The loot table, or its path from the behaviour pack root. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockMapColor
Bases: JsonComponent
The color of the block on a map. Without it, the block doesn't show on maps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
HexRGB | HexRGBA | RGB | RGBA | RGB255 | RGBA255
|
The color, written as "#RRGGBB". |
required |
tint_method
|
TintMethod
|
Tint multiplied to the color by the biome. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockMaterialInstance
Bases: JsonValueComponent
The material instances of the block: the texture and render options of each face, or
of each material instance named in the geometry. The block also needs BlockGeometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instances
|
list[MaterialInstance]
|
The instances, one per face or name. Add them with |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
add_instance(*, spec, force_vanilla=False)
Adds a material instance, and its textures to the resource pack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
InstanceSpec
|
The instance and its textures. |
required |
force_vanilla
|
bool
|
Registers the textures as vanilla textures. Defaults to False. |
False
|
BlockMovable
Bases: JsonComponent
How the block reacts to pistons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
movement_type
|
BlockMovementType
|
Pushed and pulled, pushed only, popped or immovable. Game default push_pull. |
required |
sticky
|
BlockSticky
|
"same" also moves the neighbouring blocks with the same setting. Game default "none". |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockPlacementFilter
Bases: JsonComponent
Where the block can be placed and stay. When a condition stops being met, the block pops off.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conditions
|
list[PlacementCondition]
|
The conditions, at most 64. Set them directly or add them with |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
add_condition(*, allowed_faces=None, block_filter=None)
Adds a condition. See PlacementCondition for the parameters.
BlockPrecipitationInteractions
Bases: JsonComponent
How the block interacts with rain and snow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
precipitation_behavior
|
BlockPrecipitationBehavior
|
"obstruct_rain", "obstruct_rain_accumulate_snow", "none" or "snowlogging". |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockRandomOffset
Bases: JsonComponent
Offsets the block by a random amount seeded from its position. It moves what is drawn, the outline and the collision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
OffsetRange
|
The offset along x. Set it with |
required |
y
|
OffsetRange
|
The offset along y. Set it with |
required |
z
|
OffsetRange
|
The offset along z. Set it with |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
set_x(*, range=None, steps=None)
Sets the random offset along x. See OffsetRange for the parameters.
set_y(*, range=None, steps=None)
Sets the random offset along y. See OffsetRange for the parameters.
set_z(*, range=None, steps=None)
Sets the random offset along z. See OffsetRange for the parameters.
BlockRedstoneConductivity
Bases: JsonComponent
The redstone properties of the block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
allows_wire_to_step_down
|
bool
|
Whether redstone wire can step down over the block. Game default true. |
required |
redstone_conductor
|
bool
|
Whether the block can be powered by redstone. Game default false. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockRedstoneConsumer
Bases: JsonComponent
The block consumes a redstone signal, and may pass it on. Root components only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_power
|
int
|
The signal strength, from 0 to 15, at which the |
required |
propagates_power
|
bool
|
Whether the block passes the signal on. Game default false. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockRedstoneProducer
Bases: JsonComponent
The block produces a redstone signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
power
|
int
|
The signal strength, from 0 to 15. |
required |
connected_faces
|
list[BlockFaceValues]
|
The faces connected to the circuit. Game default every face. |
required |
strongly_powered_face
|
BlockFaceValues
|
The face that is strongly powered. |
required |
transform_relative
|
bool
|
Whether the faces turn with |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockReplaceable
Bases: JsonComponent
The block is replaced when another block is placed in its position.
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockSelectionBox
Bases: _BlockBoxComponent
The area of the block the player's cursor selects. With no box, the full block is selected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
origin
|
tuple[float, float, float]
|
The minimal corner of the box, in pixels from the bottom centre of the block. |
required |
size
|
tuple[float, float, float]
|
The size of the box. The box must stay within (-8, 0, -8) and (8, 16, 8). |
required |
enabled
|
bool
|
False makes the block unselectable, written as |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
BlockSupport
Bases: JsonComponent
The support shape of the block. Without it, the block supports like a full cube.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
BlockSupportShape
|
"fence" or "stair". Stairs need the |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockTagComponent
Bases: JsonValueComponent
The tags of the block. Custom tags must be in the project namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
list[MinecraftBlockTags | str]
|
The tags. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
BlockTick
Bases: JsonComponent
Makes the block tick at intervals chosen at random from interval_range, sending onTick to its custom components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
interval_range
|
tuple[int, int]
|
The |
required |
looping
|
bool
|
Whether the block keeps ticking. Game default true. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BlockTransformation
Bases: JsonComponent
Translates, rotates and scales the block around its centre.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
translation
|
tuple[float, float, float]
|
The offset, in blocks. |
required |
rotation
|
tuple[float, float, float]
|
The rotation, in degrees, in steps of 90. |
required |
rotation_pivot
|
tuple[float, float, float]
|
The point the rotation turns around. |
required |
scale
|
tuple[float, float, float]
|
The scale. Game default (1, 1, 1). |
required |
scale_pivot
|
tuple[float, float, float]
|
The point the scale grows from. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.
__validate__()
Cross-field checks, run on export after the fields are checked.
BoneVisibility
Bases: JsonValue
Whether one bone of a custom geometry is visible. Added with add_bone_visibility.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bone
|
str
|
The bone name. Written as the key. |
required |
visible
|
bool | Molang
|
True, False, or a Molang expression evaluated against the block states. |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__validate__()
Cross-field checks, run on export after the fields are checked.
FlipbookParams
dataclass
A flipbook animation of a material instance's texture, added to flipbook_textures.json.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frames
|
list[int]
|
The atlas frames to play, in order. |
required |
ticks_per_frame
|
int
|
How long each frame shows. Defaults to 20. |
20
|
atlas_index
|
int
|
The atlas index. Defaults to 0. |
0
|
atlas_tile_variant
|
int
|
The variation the animation uses. Defaults to 0. |
0
|
replicate
|
int
|
A power of two. Defaults to 1. |
1
|
blend_frames
|
bool
|
Whether frames blend into each other. Defaults to True. |
True
|
InstanceSpec
dataclass
A material instance to add with BlockMaterialInstance.add_instance, and the textures
to take from a Blockbench model for it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blockbench
|
str
|
The Blockbench model the textures come from. |
required |
face
|
BlockFaceValues | str
|
The face, or the name of a material instance in the geometry. Defaults to every face. |
All
|
variations
|
list[InstanceVariant]
|
The textures. With more than one, the game picks one at random, by weight. |
list()
|
params
|
MaterialParams
|
How the material renders. |
MaterialParams()
|
flipbooks
|
list[FlipbookParams]
|
Flipbook animations of the texture. |
list()
|
InstanceVariant
dataclass
Bases: TextureComponents
One texture of a material instance, with its PBR maps, and its weight when the instance picks one of several textures at random.
ItemSpecificSpeed
Bases: JsonObject
How long the block takes to mine with specific items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
item
|
str | Item | ItemTagFilter
|
The item, or the tags of the items. |
required |
destroy_speed
|
float
|
The seconds to destroy the block with those items. |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
ItemTagFilter
Bases: JsonObject
Items matched by their tags, for BlockDestructibleByMining.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tags
|
Molang | str
|
A tag query, for example |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
LiquidDetectionRule
Bases: JsonObject
How the block reacts to a liquid, for BlockLiquidDetection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
liquid_type
|
Literal['water']
|
The liquid. Only water is supported. Game default water. |
required |
on_liquid_touches
|
BlockLiquidDetectionTouching
|
What happens when the liquid flows into the block. Game default blocking. |
required |
can_contain_liquid
|
bool
|
Whether the block can be waterlogged. Game default false. |
required |
stops_liquid_flowing_from_direction
|
list[BlockFaceValues]
|
The faces liquid can't flow out of the block through. |
required |
use_liquid_clipping
|
bool
|
Whether the liquid is visually clipped by the block's collision. Game default false. |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
MaterialInstance
Bases: MaterialParams
A material instance: a texture and how it renders. It also takes every option of
MaterialParams.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
face
|
BlockFaceValues | str
|
The face, or the name of a material instance in the geometry. Written as the instance's key. Defaults to every face. |
required |
texture
|
str
|
The texture's short name in |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
key
property
The instance's key in material_instances: * for every face.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
MaterialParams
Bases: JsonObject
How a material instance renders. Unset options are left out, so the game defaults apply.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
render_method
|
BlockMaterial
|
The render method. Game default opaque. |
required |
ambient_occlusion
|
float
|
Exponent applied to ambient occlusion after lighting, from 0 to 10. Game default 1. |
required |
face_dimming
|
bool
|
Whether faces are dimmed by their direction. Game default true. |
required |
isotropic
|
bool
|
Whether the texture is randomly rotated per face. |
required |
tint_method
|
TintMethod
|
Tint multiplied to the texture by the biome. |
required |
alpha_masked_tint
|
bool
|
Tints only where the texture's alpha is not 0. Needs a |
required |
emissive
|
bool
|
Whether the texture glows. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
NWayVisualRotation
Bases: JsonObject
The block states that turn a visual's geometry around each axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
str
|
The state for the x axis. |
required |
y
|
str
|
The state for the y axis, for example "minecraft:cardinal_direction". |
required |
z
|
str
|
The state for the z axis. |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
OffsetRange
Bases: JsonObject
The random offset along one axis, for BlockRandomOffset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
range
|
tuple[float, float]
|
The |
required |
steps
|
int
|
How many positions the range is split into. 0 allows any value between. Game default 0. |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
PlacementCondition
Bases: JsonObject
Where the block can be placed and stay, for BlockPlacementFilter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
allowed_faces
|
list[BlockFaceValues]
|
The faces of the block below or beside it the block can be placed on. Game default every face. |
required |
block_filter
|
list[str | Block | BlockDescriptor]
|
The blocks it can be placed on, at most 64. Game default any block. |
required |
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.
VisualGeometry
Bases: JsonObject
The geometry of an item or embedded visual.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier
|
str
|
The geometry identifier. |
required |
n_way_visual_rotation
|
NWayVisualRotation
|
The states that turn it. |
required |
Its bone_visibility is filled by the visual's add_bone_visibility.
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The JSON payload of this object, built from its fields after checking them.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of this object's JSON, adding the parts it uses to definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definitions
|
dict[str, JsonSchema]
|
The |
required |
__validate__()
Cross-field checks, run on export after the fields are checked.