Skip to content

Miscellaneous

endstone.ColorFormat

All supported color and format codes.

Attributes:

Name Type Description
AQUA
BLACK
BLUE
BOLD
DARK_AQUA
DARK_BLUE
DARK_GRAY
DARK_GREEN
DARK_PURPLE
DARK_RED
GOLD
GRAY
GREEN
ITALIC
LIGHT_PURPLE
MATERIAL_AMETHYST
MATERIAL_COPPER
MATERIAL_DIAMOND
MATERIAL_EMERALD
MATERIAL_GOLD
MATERIAL_IRON
MATERIAL_LAPIS
MATERIAL_NETHERITE
MATERIAL_QUARTZ
MATERIAL_REDSTONE
MATERIAL_RESIN
MINECOIN_GOLD
OBFUSCATED
RED
RESET
WHITE
YELLOW

AQUA class-attribute instance-attribute

AQUA = '§b'

BLACK class-attribute instance-attribute

BLACK = '§0'

BLUE class-attribute instance-attribute

BLUE = '§9'

BOLD class-attribute instance-attribute

BOLD = '§l'

DARK_AQUA class-attribute instance-attribute

DARK_AQUA = '§3'

DARK_BLUE class-attribute instance-attribute

DARK_BLUE = '§1'

DARK_GRAY class-attribute instance-attribute

DARK_GRAY = '§8'

DARK_GREEN class-attribute instance-attribute

DARK_GREEN = '§2'

DARK_PURPLE class-attribute instance-attribute

DARK_PURPLE = '§5'

DARK_RED class-attribute instance-attribute

DARK_RED = '§4'

GOLD class-attribute instance-attribute

GOLD = '§6'

GRAY class-attribute instance-attribute

GRAY = '§7'

GREEN class-attribute instance-attribute

GREEN = '§a'

ITALIC class-attribute instance-attribute

ITALIC = '§o'

LIGHT_PURPLE class-attribute instance-attribute

LIGHT_PURPLE = '§d'

MATERIAL_AMETHYST class-attribute instance-attribute

MATERIAL_AMETHYST = '§u'

MATERIAL_COPPER class-attribute instance-attribute

MATERIAL_COPPER = '§n'

MATERIAL_DIAMOND class-attribute instance-attribute

MATERIAL_DIAMOND = '§s'

MATERIAL_EMERALD class-attribute instance-attribute

MATERIAL_EMERALD = '§q'

MATERIAL_GOLD class-attribute instance-attribute

MATERIAL_GOLD = '§p'

MATERIAL_IRON class-attribute instance-attribute

MATERIAL_IRON = '§i'

MATERIAL_LAPIS class-attribute instance-attribute

MATERIAL_LAPIS = '§t'

MATERIAL_NETHERITE class-attribute instance-attribute

MATERIAL_NETHERITE = '§j'

MATERIAL_QUARTZ class-attribute instance-attribute

MATERIAL_QUARTZ = '§h'

MATERIAL_REDSTONE class-attribute instance-attribute

MATERIAL_REDSTONE = '§m'

MATERIAL_RESIN class-attribute instance-attribute

MATERIAL_RESIN = '§v'

MINECOIN_GOLD class-attribute instance-attribute

MINECOIN_GOLD = '§g'

OBFUSCATED class-attribute instance-attribute

OBFUSCATED = '§k'

RED class-attribute instance-attribute

RED = '§c'

RESET class-attribute instance-attribute

RESET = '§r'

WHITE class-attribute instance-attribute

WHITE = '§f'

YELLOW class-attribute instance-attribute

YELLOW = '§e'

endstone.GameMode

Bases: Enum

Represents the various type of game modes that Players may have.

Attributes:

Name Type Description
ADVENTURE
CREATIVE
SPECTATOR
SURVIVAL

ADVENTURE class-attribute instance-attribute

ADVENTURE = 2

CREATIVE class-attribute instance-attribute

CREATIVE = 1

SPECTATOR class-attribute instance-attribute

SPECTATOR = 3

SURVIVAL class-attribute instance-attribute

SURVIVAL = 0

endstone.Logger

Logger class which can format and output varies levels of logs.

Classes:

Name Description
Level

Specifies the log level.

Methods:

Name Description
critical

Log a message at the CRITICAL level.

debug

Log a message at the DEBUG level.

error

Log a message at the ERROR level.

info

Log a message at the INFO level.

is_enabled_for

Check if the Logger instance is enabled for the given log Level.

set_level

Set the logging level for this Logger instance.

trace

Log a message at the TRACE level.

warning

Log a message at the WARNING level.

Attributes:

Name Type Description
CRITICAL
DEBUG
ERROR
INFO
TRACE
WARNING
name str

The name of this Logger instance.

CRITICAL class-attribute instance-attribute

CRITICAL = CRITICAL

DEBUG class-attribute instance-attribute

DEBUG = DEBUG

ERROR class-attribute instance-attribute

ERROR = ERROR

INFO class-attribute instance-attribute

INFO = INFO

TRACE class-attribute instance-attribute

TRACE = TRACE

WARNING class-attribute instance-attribute

WARNING = WARNING

name property

name: str

The name of this Logger instance.

Level

Bases: IntEnum

Specifies the log level.

Attributes:

Name Type Description
CRITICAL
DEBUG
ERROR
INFO
TRACE
WARNING

CRITICAL class-attribute instance-attribute

CRITICAL = 5

DEBUG class-attribute instance-attribute

DEBUG = 1

ERROR class-attribute instance-attribute

ERROR = 4

INFO class-attribute instance-attribute

INFO = 2

TRACE class-attribute instance-attribute

TRACE = 0

WARNING class-attribute instance-attribute

WARNING = 3

critical

critical(message: str) -> None

Log a message at the CRITICAL level.

debug

debug(message: str) -> None

Log a message at the DEBUG level.

error

error(message: str) -> None

Log a message at the ERROR level.

info

info(message: str) -> None

Log a message at the INFO level.

is_enabled_for

is_enabled_for(level: Level) -> bool

Check if the Logger instance is enabled for the given log Level.

Parameters:

Name Type Description Default
level Level

The log level to check.

required

Returns:

Type Description
bool

True if the logger is enabled for the Level, False otherwise.

set_level

set_level(level: Level) -> None

Set the logging level for this Logger instance.

Parameters:

Name Type Description Default
level Level

The desired log level.

required

trace

trace(message: str) -> None

Log a message at the TRACE level.

warning

warning(message: str) -> None

Log a message at the WARNING level.

endstone.Registry

Bases: Generic[_T]

Presents a registry

Methods:

Name Description
get

Get the object by its key.

get_or_throw

Get the object by its key or throw if missing.

get

get(id: Identifier[_T] | str) -> _T | None

Get the object by its key.

get_or_throw

get_or_throw(id: Identifier[_T] | str) -> _T

Get the object by its key or throw if missing.

endstone.util

Multi and single purpose classes.

Classes:

Name Description
SocketAddress

Represents an IP Socket Address (hostname + port number).

Vector

Represents a 3-dimensional vector.

SocketAddress

SocketAddress()
SocketAddress(hostname: str, port: int)

Represents an IP Socket Address (hostname + port number).

Attributes:

Name Type Description
hostname str

The hostname of this socket address.

port int

The port number of this socket address.

hostname property

hostname: str

The hostname of this socket address.

port property

port: int

The port number of this socket address.

Vector

Vector()
Vector(x: float, y: float, z: float)

Represents a 3-dimensional vector.

Methods:

Name Description
angle

Gets the angle between this vector and another in radians.

cross_product

Calculates the cross-product of this vector with another without mutating the original.

distance

Get the distance between this vector and another.

distance_squared

Get the squared distance between this vector and another.

dot

Calculates the dot product of this vector with another.

is_in_aabb

Returns whether this vector is in an axis-aligned bounding box.

is_in_sphere

Returns whether this vector is within a sphere.

midpoint

Gets a new midpoint vector between this vector and another.

normalize

Converts this vector to a unit vector (a vector with length of 1).

normalize_zero

Converts each component of value -0.0 to 0.0.

rotate_around_axis

Rotates the vector around a given arbitrary axis in 3-dimensional space.

rotate_around_x

Rotates the vector around the x-axis.

rotate_around_y

Rotates the vector around the y-axis.

rotate_around_z

Rotates the vector around the z-axis.

zero

Zero this vector's components.

Attributes:

Name Type Description
block_x int

The floored value of the X component, indicating the block that this vector is contained with.

block_y int

The floored value of the Y component, indicating the block that this vector is contained with.

block_z int

The floored value of the Z component, indicating the block that this vector is contained with.

is_normalized bool

True if this vector is normalized.

is_zero bool

True if each component of this vector is equal to 0.

length float

The magnitude of the vector, defined as sqrt(x^2 + y^2 + z^2).

length_squared float

The magnitude of the vector squared.

x float

The X component of the vector.

y float

The Y component of the vector.

z float

The Z component of the vector.

block_x property

block_x: int

The floored value of the X component, indicating the block that this vector is contained with.

block_y property

block_y: int

The floored value of the Y component, indicating the block that this vector is contained with.

block_z property

block_z: int

The floored value of the Z component, indicating the block that this vector is contained with.

is_normalized property

is_normalized: bool

True if this vector is normalized.

is_zero property

is_zero: bool

True if each component of this vector is equal to 0.

length property

length: float

The magnitude of the vector, defined as sqrt(x^2 + y^2 + z^2).

length_squared property

length_squared: float

The magnitude of the vector squared.

x property writable

x: float

The X component of the vector.

y property writable

y: float

The Y component of the vector.

z property writable

z: float

The Z component of the vector.

angle

angle(other: Vector) -> float

Gets the angle between this vector and another in radians.

Parameters:

Name Type Description Default
other Vector

The other vector.

required

Returns:

Type Description
float

The angle in radians.

cross_product

cross_product(other: Vector) -> Vector

Calculates the cross-product of this vector with another without mutating the original.

Parameters:

Name Type Description Default
other Vector

The other vector.

required

Returns:

Type Description
Vector

A new vector containing the cross-product.

distance

distance(other: Vector) -> float

Get the distance between this vector and another.

Parameters:

Name Type Description Default
other Vector

The other vector.

required

Returns:

Type Description
float

The distance.

distance_squared

distance_squared(other: Vector) -> float

Get the squared distance between this vector and another.

Parameters:

Name Type Description Default
other Vector

The other vector.

required

Returns:

Type Description
float

The squared distance.

dot

dot(other: Vector) -> float

Calculates the dot product of this vector with another.

The dot product is defined as x1*x2 + y1*y2 + z1*z2. The returned value is a scalar.

Parameters:

Name Type Description Default
other Vector

The other vector.

required

Returns:

Type Description
float

The dot product.

is_in_aabb

is_in_aabb(min: Vector, max: Vector) -> bool

Returns whether this vector is in an axis-aligned bounding box.

The minimum and maximum vectors given must be truly the minimum and maximum X, Y and Z components.

Parameters:

Name Type Description Default
min Vector

Minimum vector.

required
max Vector

Maximum vector.

required

Returns:

Type Description
bool

Whether this vector is in the AABB.

is_in_sphere

is_in_sphere(origin: Vector, radius: float) -> bool

Returns whether this vector is within a sphere.

Parameters:

Name Type Description Default
origin Vector

Sphere origin.

required
radius float

Sphere radius.

required

Returns:

Type Description
bool

Whether this vector is in the sphere.

midpoint

midpoint(other: Vector) -> Vector

Gets a new midpoint vector between this vector and another.

Parameters:

Name Type Description Default
other Vector

The other vector.

required

Returns:

Type Description
Vector

A new midpoint vector.

normalize

normalize() -> Vector

Converts this vector to a unit vector (a vector with length of 1).

normalize_zero

normalize_zero() -> Vector

Converts each component of value -0.0 to 0.0.

rotate_around_axis

rotate_around_axis(
    axis: Vector, angle: float, normalize: bool = True
) -> Vector

Rotates the vector around a given arbitrary axis in 3-dimensional space.

Rotation will follow the general Right-Hand-Rule, which means rotation will be counterclockwise when the axis is pointing towards the observer.

Parameters:

Name Type Description Default
axis Vector

The axis to rotate the vector around.

required
angle float

The angle to rotate the vector around the axis.

required
normalize bool

When True (default), the axis vector is normalized before being used for the rotation, preserving the length of this vector.

True

rotate_around_x

rotate_around_x(angle: float) -> Vector

Rotates the vector around the x-axis.

Parameters:

Name Type Description Default
angle float

The angle to rotate the vector about, in radians.

required

rotate_around_y

rotate_around_y(angle: float) -> Vector

Rotates the vector around the y-axis.

Parameters:

Name Type Description Default
angle float

The angle to rotate the vector about, in radians.

required

rotate_around_z

rotate_around_z(angle: float) -> Vector

Rotates the vector around the z-axis.

Parameters:

Name Type Description Default
angle float

The angle to rotate the vector about, in radians.

required

zero

zero() -> Vector

Zero this vector's components.