Skip to content

Core - Camera Module

anvil.api.core.camera

AimAssistCategories

Bases: AddonObject

Represents a set of Aim Assist Categories.

To define evaluation priority between blocks and entities, a categories.json file must be created in the same directory as aim assist presets.

Documentation

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__()

Initializes the Aim Assist Categories container.

add_category(category_name)

Adds and returns a new Aim Assist Category.

Parameters:

Name Type Description Default
category_name str

Name of the category.

required

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self AddonObject

The instance of the current AddonObject.

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

AimAssistCategory

Helper class representing a single Aim Assist Category.

Categories define the evaluation priority between entities and blocks. Included in AimAssistCategories.

__init__(name)

Initializes the Aim Assist Category.

Parameters:

Name Type Description Default
name str

Name of the category.

required

block_default(value)

Sets the default priority for blocks in this category.

Parameters:

Name Type Description Default
value int

Default priority value.

required

block_priority(block, priority)

Sets the priority for a specific block type.

Parameters:

Name Type Description Default
block str

Block identifier.

required
priority int

Priority value.

required

entity_default(value)

Sets the default priority for entities in this category.

Parameters:

Name Type Description Default
value int

Default priority value.

required

entity_priority(entity, priority)

Sets the priority for a specific entity type.

Parameters:

Name Type Description Default
entity str

Entity identifier.

required
priority int

Priority value.

required

export()

Legacy alias for export to prevent breaking potential callers.

AimAssistPreset

Bases: AddonObject

Represents an Aim Assist Preset in Minecraft Bedrock.

Aim assist presets allow creators to customize targeting rules, such as excluding specific entities/blocks, setting item priorities, or defining liquid-targeting rules.

Placed under the behavior pack folder: cameras/presets/.

Documentation

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__(name)

Initializes the Aim Assist Preset.

Parameters:

Name Type Description Default
name str

Unique name of the preset.

required

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self AddonObject

The instance of the current AddonObject.

default_item_settings(setting)

Sets the default aim assist category for items not listed in item_settings.

Parameters:

Name Type Description Default
setting str

The category name.

required

exclusion_list(exclusions)

Specifies entities or blocks that the aim assist will ignore.

Parameters:

Name Type Description Default
exclusions dict

Dictionary specifying blocks and/or entities to exclude.

required

hand_settings(setting)

Sets the aim assist behavior applied when the player is not holding any items.

Parameters:

Name Type Description Default
setting str

The category name.

required

item_settings(settings)

Specifies which category of aim assist rules to use when specific items are held.

Parameters:

Name Type Description Default
settings dict

Key-value pairs of item names and category IDs.

required

liquid_targeting_list(targets)

Lists the items that are allowed to target liquids.

Parameters:

Name Type Description Default
targets dict

Dictionary specifying liquid targeting items.

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

CameraPreset

Bases: AddonObject

Represents a custom Camera Preset in Minecraft Bedrock.

Camera presets allow creators to customize how players view the game. These presets are stored in the behavior pack at cameras/presets/.

Documentation

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__(name, inherit_from)

Initializes the CameraPreset instance.

Parameters:

Name Type Description Default
name str

Unique name identifier for the preset.

required
inherit_from CameraPresets | CameraPreset | str

The base preset to inherit settings from. Can be a vanilla CameraPresets enum, another custom CameraPreset instance, or its identifier string.

required

aim_assist(preset, target_mode=AimAssistTargetMode.Distance, angle=[30.0, 30.0], distance=8.0, replace_reticle=False)

Configures targeting aid/assist options for the camera.

Parameters:

Name Type Description Default
preset AimAssistPreset

Aim assist preset to apply.

required
target_mode AimAssistTargetMode

Evaluation mode (e.g. Distance, Angle).

Distance
angle list[float]

Horizontal/vertical angles defining target search cone.

[30.0, 30.0]
distance float

Target search distance. Clamped between 1.0 and 16.0 blocks.

8.0
replace_reticle bool

Whether custom reticle UI textures should be copied.

False

content(content)

Sets the content of the addon object and returns the object.

Parameters:

Name Type Description Default
content any

The content to be set for the addon object.

required

Returns:

Name Type Description
self AddonObject

The instance of the current AddonObject.

control_scheme(value)

Overrides the default input response scheme for this camera.

Parameters:

Name Type Description Default
value ControlSchemes | str

The control scheme, such as 'camera_relative'.

required

entity_offset(x_offset, y_offset, z_offset)

Sets the target entity tracking offset.

Parameters:

Name Type Description Default
x_offset float

X coordinate offset.

required
y_offset float

Y coordinate offset.

required
z_offset float

Z coordinate offset.

required

extend_player_rendering(value=True)

Extends entity rendering distance so chunks and entities render at further distances.

Optimized to render the player and leashed entities.

Parameters:

Name Type Description Default
value bool

Whether to extend rendering distance. Defaults to True.

True

focus_target(rotation_speed=0.0, snap_to_target=False, horizontal_rotation_limit=[0.0, 360.0], vertical_rotation_limit=[0.0, 180.0], continue_targeting=False, tracking_radius=50.0)

Enables target tracking of a specific entity with custom boundaries.

Parameters:

Name Type Description Default
rotation_speed float

Degrees per second tracking rotation speed. Defaults to 0.0 (perfect tracking).

0.0
snap_to_target bool

If True, snaps tracking immediately on first frame.

False
horizontal_rotation_limit list[float]

Left and right rotation angle limit degrees. Max sum 360.0.

[0.0, 360.0]
vertical_rotation_limit list[float]

Up and down rotation angle limit degrees. Max sum 180.0.

[0.0, 180.0]
continue_targeting bool

Whether to continue tracking when target leaves rotation/radius boundaries.

False
tracking_radius float

Maximum block distance inside which target is tracked.

50.0

listener(value)

Specifies where the sound listener "ears" are positioned while using the camera.

Parameters:

Name Type Description Default
value bool | str

If True or 'player', uses the player's position. If False or 'camera', uses the camera's position.

required

player_effects(value)

Enables or disables screen effects (like fire, night vision, blindness) for this camera preset.

Parameters:

Name Type Description Default
value bool

Whether the camera renders player effects.

required

position(x=None, y=None, z=None)

Sets the constant coordinate overrides for the camera.

Parameters:

Name Type Description Default
x float

Override for target camera's X position.

None
y float

Override for target camera's Y position.

None
z float

Override for target camera's Z position.

None

queue()

Queues the camera preset to be exported.

radius(radius)

Sets the orbital radius (distance from target) for boom/follow/orbit cameras.

Parameters:

Name Type Description Default
radius float

Radius in blocks. Clamped between 0.1 and 100.0.

required

rotation(x=None, y=None)

Sets the default rotation pitch and yaw overrides for the camera.

Parameters:

Name Type Description Default
x float

The pitch (vertical rotation) of the camera in degrees. Clamped between -90 and 90.

None
y float

The yaw (horizontal rotation) of the camera in degrees.

None

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

starting_rotation(x=None, y=None)

Sets the initial starting rotation pitch and yaw of the camera.

Parameters:

Name Type Description Default
x float

The initial pitch in degrees. Clamped between -90 and 90.

None
y float

The initial yaw in degrees.

None

view_offset(x_offset, y_offset)

Sets the view offset relative to the camera position.

Parameters:

Name Type Description Default
x_offset float

X view offset.

required
y_offset float

Y view offset.

required