Skip to content

Level

endstone.level

Classes:

Name Description
Chunk

Represents a chunk of blocks.

Dimension

Represents a dimension within a Level.

Level

Represents a level, which may contain actors, chunks and blocks.

Location

Represents a 3-dimensional location in a dimension within a level.

Chunk

Represents a chunk of blocks.

Attributes:

Name Type Description
dimension Dimension

The dimension containing this chunk.

level Level

The level containing this chunk.

x int

X-coordinate of this chunk.

z int

Z-coordinate of this chunk.

dimension property

dimension: Dimension

The dimension containing this chunk.

level property

level: Level

The level containing this chunk.

x property

x: int

X-coordinate of this chunk.

z property

z: int

Z-coordinate of this chunk.

Dimension

Represents a dimension within a Level.

Methods:

Name Description
drop_item

Drops an item at the specified Location.

get_block_at
get_highest_block_at
get_highest_block_y_at

Gets the highest non-empty (impassable) coordinate at the given coordinates.

spawn_actor

Creates an actor at the given Location.

Attributes:

Name Type Description
NETHER Identifier[Dimension]
OVERWORLD Identifier[Dimension]
THE_END Identifier[Dimension]
actors list[Actor]

A list of all actors currently residing in this dimension.

id Identifier[Dimension]

The identifier of this dimension.

level Level

The level to which this dimension belongs.

loaded_chunks list[Chunk]

A list of all loaded Chunks.

translation_key str

The translation key, suitable for use in a translation component.

NETHER class-attribute instance-attribute

NETHER: Identifier[Dimension] = 'minecraft:nether'

OVERWORLD class-attribute instance-attribute

OVERWORLD: Identifier[Dimension] = 'minecraft:overworld'

THE_END class-attribute instance-attribute

THE_END: Identifier[Dimension] = 'minecraft:the_end'

actors property

actors: list[Actor]

A list of all actors currently residing in this dimension.

id property

id: Identifier[Dimension]

The identifier of this dimension.

level property

level: Level

The level to which this dimension belongs.

loaded_chunks property

loaded_chunks: list[Chunk]

A list of all loaded Chunks.

translation_key property

translation_key: str

The translation key, suitable for use in a translation component.

drop_item

drop_item(location: Location, item: ItemStack) -> Item

Drops an item at the specified Location.

Parameters:

Name Type Description Default
location Location

Location to drop the item.

required
item ItemStack

ItemStack to drop.

required

Returns:

Type Description
Item

Item entity created as a result of this method.

get_block_at

get_block_at(location: Location) -> Block
get_block_at(x: int, y: int, z: int) -> Block

get_highest_block_at

get_highest_block_at(location: Location) -> Block
get_highest_block_at(x: int, z: int) -> Block

get_highest_block_y_at

get_highest_block_y_at(x: int, z: int) -> int

Gets the highest non-empty (impassable) coordinate at the given coordinates.

Parameters:

Name Type Description Default
x int

X-coordinate of the blocks.

required
z int

Z-coordinate of the blocks.

required

Returns:

Type Description
int

Y-coordinate of the highest non-empty block.

spawn_actor

spawn_actor(
    location: Location, type: Identifier[ActorType] | str
) -> Actor

Creates an actor at the given Location.

Parameters:

Name Type Description Default
location Location

The location to spawn the actor.

required
type Identifier[ActorType] | str

The actor type to spawn.

required

Returns:

Type Description
Actor

Resulting Actor of this method.

Level

Represents a level, which may contain actors, chunks and blocks.

Methods:

Name Description
get_dimension

Gets the dimension with the given id.

Attributes:

Name Type Description
actors list[Actor]

A list of all actors currently residing in this level.

dimensions list[Dimension]

A list of all dimensions within this level.

name str

The unique name of this level.

seed int

The Seed for this level.

time int

The relative in-game time of this level.

actors property

actors: list[Actor]

A list of all actors currently residing in this level.

dimensions property

dimensions: list[Dimension]

A list of all dimensions within this level.

name property

name: str

The unique name of this level.

seed property

seed: int

The Seed for this level.

time property writable

time: int

The relative in-game time of this level.

get_dimension

get_dimension(id: Identifier[Dimension] | str) -> Dimension

Gets the dimension with the given id.

Parameters:

Name Type Description Default
id Identifier[Dimension] | str

The id of the dimension to retrieve.

required

Returns:

Type Description
Dimension

The Dimension with the given id, or None if none exists.

Location

Location(
    dimension: Dimension,
    x: float,
    y: float,
    z: float,
    pitch: float = 0.0,
    yaw: float = 0.0,
)

Represents a 3-dimensional location in a dimension within a level.

Methods:

Name Description
distance

Get the distance between this location and another.

distance_squared

Get the squared distance between this location and another.

normalize_pitch

Normalizes the given pitch angle to a value between +/-90 degrees.

normalize_yaw

Normalizes the given yaw angle to a value between +/-180 degrees.

zero

Zero this location's components. Not world-aware.

Attributes:

Name Type Description
block Block

The block at the represented location.

block_x int

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

block_y int

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

block_z int

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

dimension Dimension

The Dimension that contains this position.

direction Vector

A unit-vector pointing in the direction that this Location is facing.

length float

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

length_squared float

The magnitude of the location squared.

pitch float

The pitch of this location, measured in degrees.

x float

The x-coordinate of this location.

y float

The y-coordinate of this location.

yaw float

The yaw of this location, measured in degrees.

z float

The z-coordinate of this location.

block property

block: Block

The block at the represented location.

block_x property

block_x: int

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

block_y property

block_y: int

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

block_z property

block_z: int

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

dimension property writable

dimension: Dimension

The Dimension that contains this position.

direction property writable

direction: Vector

A unit-vector pointing in the direction that this Location is facing.

length property

length: float

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

Not world-aware and orientation independent.

length_squared property

length_squared: float

The magnitude of the location squared.

Not world-aware and orientation independent.

pitch property writable

pitch: float

The pitch of this location, measured in degrees.

x property writable

x: float

The x-coordinate of this location.

y property writable

y: float

The y-coordinate of this location.

yaw property writable

yaw: float

The yaw of this location, measured in degrees.

z property writable

z: float

The z-coordinate of this location.

distance

distance(other: Location) -> float

Get the distance between this location and another.

Parameters:

Name Type Description Default
other Location

The other location.

required

Returns:

Type Description
float

The distance.

distance_squared

distance_squared(other: Location) -> float

Get the squared distance between this location and another.

Parameters:

Name Type Description Default
other Location

The other location.

required

Returns:

Type Description
float

The distance.

normalize_pitch staticmethod

normalize_pitch(pitch: float) -> float

Normalizes the given pitch angle to a value between +/-90 degrees.

Parameters:

Name Type Description Default
pitch float

The pitch in degrees.

required

Returns:

Type Description
float

The normalized pitch in degrees.

normalize_yaw staticmethod

normalize_yaw(yaw: float) -> float

Normalizes the given yaw angle to a value between +/-180 degrees.

Parameters:

Name Type Description Default
yaw float

The yaw in degrees.

required

Returns:

Type Description
float

The normalized yaw in degrees.

zero

zero() -> Location

Zero this location's components. Not world-aware.