endstone.util

Multi and single purpose classes.

Multi and single purpose classes.

Classes

NameDescription
SocketAddress

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

Vector

Represents a 3-dimensional vector.

classSocketAddress

SocketAddress()

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

Attributes

NameTypeDescription
hostnamestr

Gets the hostname.

portint

Gets the port number.

attrhostnameproperty

hostname: str

Gets the hostname.

attrportproperty

port: int

Gets the port number.

classVector

Vector()

Represents a 3-dimensional vector.

Methods

NameDescription
angle

Gets the angle between this vector and another in radians.

cross_product

Calculates the cross-product of this vector with another.

distance

The distance between this Vector and another

distance_squared

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

NameTypeDescription
block_xint

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

block_yint

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

block_zint

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

is_normalizedbool

Returns if a vector is normalized.

is_zerobool

Check whether or not each component of this vector is equal to 0.

lengthfloat

The magnitude of the Vector

length_squaredfloat

The squared magnitude of the Vector

xfloat

The X component of the vector

yfloat

The Y component of the vector

zfloat

The Z component of the vector

attrblock_xproperty

block_x: int

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

attrblock_yproperty

block_y: int

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

attrblock_zproperty

block_z: int

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

attris_normalizedproperty

is_normalized: bool

Returns if a vector is normalized.

attris_zeroproperty

is_zero: bool

Check whether or not each component of this vector is equal to 0.

attrlengthproperty

length: float

The magnitude of the Vector

attrlength_squaredproperty

length_squared: float

The squared magnitude of the Vector

attrxproperty

The X component of the vector

attryproperty

The Y component of the vector

attrzproperty

The Z component of the vector

methangle

angle(other: Vector) -> float

Gets the angle between this vector and another in radians.

methcross_product

cross_product(other: Vector) -> Vector

Calculates the cross-product of this vector with another.

methdistance

distance(other: Vector) -> float

The distance between this Vector and another

methdistance_squared

distance_squared(other: Vector) -> float

The squared distance between this Vector and another

methdot

dot(other: Vector) -> float

Calculates the dot product of this vector with another.

methis_in_aabb

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

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

methis_in_sphere

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

Returns whether this vector is within a sphere.

methmidpoint

midpoint(other: Vector) -> Vector

Gets a new midpoint vector between this vector and another.

methnormalize

normalize() -> Vector

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

methnormalize_zero

normalize_zero() -> Vector

Converts each component of value -0.0 to 0.0

methrotate_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.

methrotate_around_x

rotate_around_x(angle: float) -> Vector

Rotates the vector around the x-axis.

methrotate_around_y

rotate_around_y(angle: float) -> Vector

Rotates the vector around the y-axis.

methrotate_around_z

rotate_around_z(angle: float) -> Vector

Rotates the vector around the z-axis.

methzero

zero() -> Vector

Zero this vector's components.

On this page