Skip to content

Enums

src.anvil.api.enums

Anchor

Bases: StrEnum

Enumeration representing the two anchor points that can be used in Minecraft: the feet and the eyes.

BlockFaces

Bases: StrEnum

Enumeration representing the different faces of a block in Minecraft.

BlockMaterial

Bases: StrEnum

Enumeration representing the different types of rendering methods a block can use in Minecraft.

CameraShakeType

Bases: StrEnum

Enumeration representing the types of camera shakes that can occur in Minecraft.

CloneMode

Bases: StrEnum

Enumeration representing the different modes that can be used when cloning in Minecraft.

DamageCause

Bases: StrEnum

Enumeration for the different causes of damage in the game.

Difficulty

Bases: StrEnum

Enumeration for the different levels of game difficulty.

Dimension

Bases: StrEnum

Enumeration for the different dimensions in the game.

Effects

Bases: StrEnum

Enumeration for the different types of effects in the game.

FilterEquipmentDomain

Bases: StrEnum

Enumeration representing the different equipment domains that can be used in filters in Minecraft.

FilterOperation

Bases: StrEnum

Enumeration representing the different operations that can be used in filters in Minecraft.

FilterSubject

Bases: StrEnum

Enumeration representing the different subjects that can be used in filters in Minecraft.

FogCameraLocation

Bases: StrEnum

Enumeration for the different locations of the fog camera in the game.

Gamemodes

Bases: StrEnum

Enumeration for the different types of game modes.

InputPermissions

Bases: StrEnum

Enumeration representing the different input permissions that can be set for a player in Minecraft.

ItemCategory

Bases: StrEnum

Enumeration representing the categories of blocks and items that can be used in Minecraft.

LootPoolType

Bases: StrEnum

Enumeration for the different types of loot pools.

MaskMode

Bases: StrEnum

Enumeration representing the different mask modes that can be applied in Minecraft.

MaterialDefinitions

Bases: StrEnum

Enumeration representing the different definitions that can be set for a material in Minecraft.

MaterialFunc

Bases: StrEnum

Enumeration representing the different functions that can be set for a material in Minecraft.

MaterialOperation

Bases: StrEnum

Enumeration representing the different operations that can be set for a material in Minecraft.

MaterialStates

Bases: StrEnum

Enumeration representing the different states a material can be in Minecraft.

MusicCategory

Bases: StrEnum

Enumeration for the different categories of music in the game.

Population

Bases: StrEnum

Enumeration for the different types of in-game populations.

RawTextConstructor

A class that constructs raw text with various possible styling and structures.

Attributes:

Name Type Description
_raw_text list

The raw text being constructed, stored as a list of dictionaries representing different parts.

__init__()

Initializes a new RawTextConstructor instance.

__str__()

Converts the RawTextConstructor instance to a string.

Returns:

Name Type Description
str str

A string representation of the raw text.

score(objective, target)

Appends the score of the given target under the given objective to the raw text.

Parameters:

Name Type Description Default
objective str

The objective under which the target's score is tracked.

required
target Selector | Target | str

The target whose score is to be appended.

required

Returns:

Name Type Description
self

The instance of the current RawTextConstructor.

selector(target)

Appends the selector of the given target to the raw text.

Parameters:

Name Type Description Default
target Selector | Target | str

The target whose selector is to be appended.

required

Returns:

Name Type Description
self

The instance of the current RawTextConstructor.

style(*styles)

Applies the provided styles to the raw text.

Parameters:

Name Type Description Default
styles Style

The styles to be applied.

()

Returns:

Name Type Description
self

The instance of the current RawTextConstructor.

text(text)

Appends the given text to the raw text.

Parameters:

Name Type Description Default
text str

The text to be appended.

required

Returns:

Name Type Description
self

The instance of the current RawTextConstructor.

translate(text)

Localizes the given text and appends it to the raw text.

Parameters:

Name Type Description Default
text str

The text to be localized and appended.

required

Returns:

Name Type Description
self

The instance of the current RawTextConstructor.

RenderDistanceType

Bases: StrEnum

Enumeration for the different types of render distances in the game.

ScoreboardOperation

Bases: StrEnum

Enumeration for the different operations that can be performed on a scoreboard.

ScoreboardOperator

Bases: StrEnum

Enumeration for the different types of mathematical operators.

Selector

A class used to construct a target selector for Minecraft commands. The class offers various methods to set target parameters such as its type, name, count, coordinates, distance, volume, scores, rotation, permissions, and gamemode.

__init__(target=Target.S)

Initializes a Selector object.

Parameters:

Name Type Description Default
target Target

The target type. Defaults to Target.S (self).

S

__str__()

Returns the target selector as a string.

coordinates(*, x=None, y=None, z=None)

Sets the coordinates of the target.

Parameters:

Name Type Description Default
x coordinate

The x coordinate. Defaults to None.

None
y coordinate

The y coordinate. Defaults to None.

None
z coordinate

The z coordinate. Defaults to None.

None

count(count)

Sets the count of the target.

Parameters:

Name Type Description Default
count int

The number of targets to select.

required

distance(*, r=None, rm=None)

Sets the distance of the target.

Parameters:

Name Type Description Default
r coordinate

The maximum distance. Defaults to None.

None
rm coordinate

The minimum distance. Defaults to None.

None

family(family)

Sets the family of the target.

Parameters:

Name Type Description Default
family str

The family of the target.

required

gamemode(gamemode)

Selects targets that have the specified gamemode.

Parameters:

Name Type Description Default
gamemode Gamemodes

The gamemode to check for.

required

has_item(*, item, data=-1, quantity=None, location=None, slot=None)

Selects targets that have the specified item.

Parameters:

Name Type Description Default
item str | Identifier

The item to check for.

required
data int

The data value of the item. Defaults to -1.

-1
quantity int

The quantity of the item. Defaults to None.

None
location Slots

The location of the item. Defaults to None.

None
slot int

The slot of the item. Defaults to None.

None

has_permission(*, camera=None, movement=None)

Selects targets that have the specified permissions.

Parameters:

Name Type Description Default
camera bool

Defaults to None.

None
movement bool

Defaults to None.

None

has_property(**properties)

Selects targets that have the specified property.

Parameters:

Name Type Description Default
property str

The property to check for.

required
value str

The value of the property.

required

name(name)

Sets the name of the target.

Parameters:

Name Type Description Default
name str

The name of the target.

required

rotation(*, ry=None, rym=None, rx=None, rxm=None)

Sets the rotation of the target.

Parameters:

Name Type Description Default
ry float

The maximum yaw. Defaults to None.

None
rym float

The minimum yaw. Defaults to None.

None
rx float

The maximum pitch. Defaults to None.

None
rxm float

The minimum pitch. Defaults to None.

None

scores(**scores)

Sets the scores of the target.

Example

selector.scores(score1=1, score2=2, score3=3)

tag(*tags)

Sets the tags of the target.

Example

selector.tag("tag1", "!tag2")

type(*types)

Sets the type of the target.

volume(*, dx=None, dy=None, dz=None)

Sets the volume of the target.

Parameters:

Name Type Description Default
dx float

The x volume. Defaults to None.

None
dy float

The y volume. Defaults to None.

None
dz float

The z volume. Defaults to None.

None

Slots

Bases: StrEnum

Enumeration for the different types of inventory slots in the game.

SoundCategory

Bases: StrEnum

Enumeration for the different categories of sounds in the game.

Style

Bases: StrEnum

Enumeration for the different styles of text in the game.

Target

Bases: StrEnum

Enumeration for the types of targets that can be selected in Minecraft.

WeatherSet

Bases: StrEnum

Enumeration representing the different types of weather that can be set in Minecraft.