Skip to content

Blocks - Components Module

anvil.api.blocks.components

BlockCollisionBox

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(size, origin)

Defines the area of the block that collides with entities.

Parameters:

Name Type Description Default
size list[float]

The size of the collision box.

required
origin list[float]

The origin of the collision box.

required

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockCraftingTable

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(table_name, crafting_tags)

Makes your block into a custom crafting table which enables the crafting table UI and the ability to craft recipes.

Parameters:

Name Type Description Default
table_name str

The display name of the crafting table.

required
crafting_tags list[str]

A list of tags that define which recipes can be crafted at this crafting table.

required

Raises:

Type Description
IndexError

The crafting table tags cannot exceed 64 tags.

ValueError

The crafting table tags are limited to 64 characters.

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockCustomComponents

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(component_name)

Allows you to add custom components to a block.

Parameters:

Name Type Description Default
component_name str

The components name to register, if the namespace is not provided, the project namespace will be used.

required
Documentation reference:
https://learn.microsoft.com/en-us/minecraft/creator/documents/scripting/custom-components

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockDefault

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__()

The default block component.

__iter__()

Iterates over the component's fields.

ambient_occlusion_exponent(exponent)

The exponent for ambient occlusion of the block.

carried_textures(**kwParameters)

The carried textures of the block.

isotropic(**kwParameters)

The isotropic of the block.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

sound(sound)

The sound of the block.

textures(**kwParameters)

The textures of the block.

BlockDestructibleByExplosion

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(explosion_resistance=None)

Describes the destructible by explosion properties for this block.

Parameters:

Name Type Description Default
explosion_resistance int

The amount of resistance to explosions in a range of 0 to 100.

None

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockDestructibleByMining

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(seconds_to_destroy=None)

Describes the destructible by mining properties for this block.

Parameters:

Name Type Description Default
seconds_to_destroy int

The amount of time it takes to destroy the block in seconds. If None, disables mining destructibility.

None

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockDestructionParticles

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(blockbench_name, texture=None, tint_method=TintMethod.None_)

Sets the particles that will be used when the block is destroyed.

Parameters:

Name Type Description Default
blockbench_name str

The name of the blockbench model.

required
texture str

The texture name used for the particle.

None
tint_method TintMethod

Tint multiplied to the color. Defaults to TintMethod.None_.

None_

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockDisplayName

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(display_name, localized_key=None)

Sets the block display name within Minecraft: Bedrock Edition. This component may also be used to pull from the localization file by referencing a key from it.

Parameters:

Name Type Description Default
display_name str

Set the display name for an block.

required
localized_key str

The localization key to use for the block's display name. If not provided, a key will be generated.

None

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockEmbeddedVisual

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(blockbench_name=None)

__init__() -> None
__init__(blockbench_name: str) -> None

The description identifier of the geometry and material used to render this block when it it is embedded inside of another block (for example, a flower inside of a flower pot).

Parameters:

Name Type Description Default
blockbench_name str

The geometry of the item. Defaults to None for default full block geometry.

None
Documentation reference:
https://learn.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/examples/blockcomponents/minecraftblock_embedded_visual

__iter__()

Iterates over the component's fields.

material_instance(blockbench_name, texture, block_face=BlockFaces.All, render_method=BlockMaterial.Opaque)

Adds a material instance to the embedded visual.

Parameters:

Name Type Description Default
blockbench_name str

The blockbench reference name.

required
texture str

The texture of the block.

required
block_face BlockFaces

The face of the block to apply the texture to.

All

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockFlammable

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(catch_chance_modifier, destroy_chance_modifier)

Describes the flammable properties for this block.

Parameters:

Name Type Description Default
catch_chance_modifier int

The chance that this block will catch fire in a range of 0 to 100.

required
destroy_chance_modifier int

The chance that this block will be destroyed when on fire in a range of 0 to 100.

required

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockFlowerPottable

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__()

Indicates that this block can be placed in a flower pot.

Documentation reference:
https://learn.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/examples/blockcomponents/minecraftblock_flower_pottable

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockFriction

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(friction=0.4)

Describes the friction for this block in a range of 0.0 to 0.9.

Parameters:

Name Type Description Default
friction float

The friction of the block. Defaults to 0.4.

0.4

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockGeometry

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(blockbench_name=None, uv_lock=False)

__init__(blockbench_name: str, uv_lock: bool = False) -> None
__init__() -> None

The description identifier of the geometry file to use to render this block. Parameters: blockbench_name (str, optional): The name of the Blockbench model to use to render this block. Defaults to "minecraft:geometry.full_block". uv_lock (bool, optional): A Boolean locking UV orientation of all bones in the geometry, or an array of strings locking UV orientation of specific bones in the geometry. For performance reasons it is recommended to use the Boolean. Note that for cubes using Box UVs, rather than Per-face UVs, 'uv_lock' is only supported if the cube faces are square.

__iter__()

Iterates over the component's fields.

block_culling()

Specifies the block culling rules for the geometry file.

bone_visibility(**bone)

Specifies the visibility of bones in the geometry file.

Example

BlockGeometry('block').bone_visibility(bone0=True, bone1=False)

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockItemVisual

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(blockbench_name=None)

__init__() -> None
__init__(blockbench_name: str) -> None

The description identifier of the geometry and material used to render the item of this block.

Parameters:

Name Type Description Default
blockbench_name str

The geometry of the item. Defaults to None for default full block geometry.

None

__iter__()

Iterates over the component's fields.

material_instance(blockbench_name, texture, block_face=BlockFaces.All, render_method=BlockMaterial.Opaque)

Adds a material instance to the item visual.

Parameters:

Name Type Description Default
blockbench_name str

The blockbench reference name.

required
texture str

The texture of the item.

required
block_face BlockFaces

The face of the block to apply the texture to.

All

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockLightDampening

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(light_dampening=15)

The amount that light will be dampened when it passes through the block in a range of 0 to 15.

Parameters:

Name Type Description Default
light_dampening int

The amount of light dampening. Defaults to 15.

15

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockLightEmission

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(light_emission=0)

The amount of light this block will emit in a range of 0 to 15.

Parameters:

Name Type Description Default
light_emission int

The amount of light emission. Defaults to 0.

0

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockLiquidDetection

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__()

The block's liquid detection.

__iter__()

Iterates over the component's fields.

add_rule(liquid_type='minecraft:water', on_liquid_touches=BlockLiquidDetectionTouching.Blocking, can_contain_liquid=False, stops_liquid_flowing_from_direction=[])

Adds a rule to the liquid detection.

Parameters:

Name Type Description Default
liquid_type str

The type of liquid, defaults to "minecraft:water".

'minecraft:water'
on_liquid_touches BlockLiquidDetectionTouching

The action to take when the liquid touches the block.

Blocking
can_contain_liquid bool

Whether the block can contain the liquid. Defaults to False.

False

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockLootTable

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(loot_table)

SSets the loot table for what items this block drops upon being broken.

Parameters:

Name Type Description Default
loot_table LootTable | str

The loot table to use for this block.

required

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockMapColor

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(color, tint_method=TintMethod.None_)

Sets the color of the block when rendered to a map. If this component is omitted, the block will not show up on the map.

Parameters:

Name Type Description Default
color str

The color is represented as a hex value in the format "#RRGGBB". May also be expressed as an array of [R, G, B] from 0 to 255.

required
tint_method str

Optional, tint multiplied to the color. Tint method logic varies, but often refers to the "rain" and "temperature" of the biome the block is placed in to compute the tint. Defaults to None.

None_
Documentation reference:
https://learn.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/examples/blockcomponents/minecraftblock_map_color

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockMovable

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(movement_type=BlockMovementType.PushPull, sticky='none')

The description identifier of the movable component.

Parameters:

Name Type Description Default
movement_type BlockMovementType

How the block reacts to being pushed by another block like a piston. Defaults to BlockMovementType.PushPull.

PushPull
sticky str

How the block should handle adjacent blocks around it when being pushed by another block like a piston. Defaults to "none".

'none'
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/blockreference/examples/blockcomponents/minecraft_movable

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockPlacementFilter

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__()

By default, custom blocks can be placed anywhere and do not have placement restrictions unless you specify them in this component.

__iter__()

Iterates over the component's fields.

add_condition(allowed_faces, block_filter)

Adds a condition to the placement filter.

Parameters:

Name Type Description Default
allowed_faces list[BlockFaces]

The faces of the block that are allowed to be placed on.

required
block_filter list[BlockDescriptor | str]

The blocks that are allowed to be placed on.

required

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockRedstoneConductivity

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(allows_wire_to_step_down=True, redstone_conductor=False)

Specifies whether a block has redstone properties. If the component is not provided, the default values are used.

Parameters:

Name Type Description Default
allows_wire_to_step_down bool

Specifies if redstone wire can stair-step downward on the block, Defaults to True.

True
redstone_conductor bool

Specifies if the block can be powered by redstone, Defaults to False.

False
Documentation reference:
https://learn.microsoft.com/en-gb/minecraft/creator/reference/content/blockreference/examples/blockcomponents/minecraft_redstone_conductivity

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockRedstoneProducer

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(power=0, connected_faces=[BlockFaces.All], strongly_powered_face=None, transform_relative=False)

Indicates that this block produces a redstone signal.

Parameters:

Name Type Description Default
power int

Signal strength produced by the block (0-15). Defaults to 0.

0
connected_faces list[BlockFaces]

Faces considered connected to the circuit. If omitted, all faces are connected.

[All]
strongly_powered_face BlockFaces | str

The face that will be strongly powered by this block.

None
transform_relative bool

If true, connected_faces and strongly_powered_face are transformed relative to the block's transformation. Defaults to False.

False
Documentation reference:
https://learn.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/examples/blockcomponents/minecraftblock_redstone_producer

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockSelectionBox

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(size, origin)

Defines the area of the block that is selected by the player's cursor.

Parameters:

Name Type Description Default
size list[float]

The size of the selection box.

required
origin list[float]

The origin of the selection box.

required

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockTick

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__(interval_range=(0, 0), looping=True)

Causes the block to tick at intervals randomly chosen from interval_range.

Parameters:

Name Type Description Default
interval_range tuple[int, int]

[min, max] ticks before next tick. Defaults to (0, 0).

(0, 0)
looping bool

If True, block will continue ticking; otherwise it ticks only once. Defaults to True.

True
Documentation reference:
https://learn.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/examples/blockcomponents/minecraftblock_tick

__iter__()

Iterates over the component's fields.

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

BlockTransformation

Bases: _BaseComponent

identifier property

Returns the identifier of the addon object in the format 'namespace:name'.

Returns:

Name Type Description
str Identifier

The identifier of the addon object.

name property

Returns the name of the addon object.

Returns:

Name Type Description
str str

The name of the addon object.

__init__()

The block's transfomration.

__iter__()

Iterates over the component's fields.

rotation(rotation, rotation_pivot=(0, 0, 0))

The block's rotation.

Parameters:

Name Type Description Default
rotation position

The block's rotation.

required

scale(scale, scale_pivot=(0, 0, 0))

The block's scale.

Parameters:

Name Type Description Default
scale position

The block's scale.

required

set_identifier_data(data)

Sets the data of the addon object.

Parameters:

Name Type Description Default
data any

The data to be set for the addon object.

required

translation(translation)

The block's translation.

Parameters:

Name Type Description Default
translation position

The block's translation.

required