endstone/level

Classes

NameDescription
ChunkRepresents a chunk of blocks.
DimensionRepresents a dimension within a Level.
LevelRepresents a level, which may contain actors, chunks and blocks.
LocationRepresents a 3-dimensional location in a dimension within a level.

classChunk

Defined in <endstone/level/chunk.h>

Represents a chunk of blocks.

Methods

NameDescription
~Chunk
getXGets the X-coordinate of this chunk.
getZGets the Z-coordinate of this chunk.
getLevelGets the level containing this chunk.
getDimensionGets the dimension containing this chunk.

meth~Chunkvirtual

~Chunk() =default

methgetXabstractconst

int getX() const =0

Gets the X-coordinate of this chunk.

Returns

TypeDescription
intX-coordinate

methgetZabstractconst

int getZ() const =0

Gets the Z-coordinate of this chunk.

Returns

TypeDescription
intZ-coordinate

methgetLevelabstractconst

Level& getLevel() const =0

Gets the level containing this chunk.

Returns

TypeDescription
Level&Parent Level

methgetDimensionabstractconst

Dimension& getDimension() const =0

Gets the dimension containing this chunk.

Returns

TypeDescription
Dimension&Parent Dimension

classDimension

Defined in <endstone/level/dimension.h>

Represents a dimension within a Level.

Enums

NameDescription
TypeRepresents various dimension types.

Methods

NameDescription
~Dimension
getNameGets the name of this dimension.
getTypeGets the type of this dimension.
getLevelGets the level to which this dimension belongs.
getBlockAtGets the Block at the given coordinates.
getBlockAtGets the Block at the given Location.
getHighestBlockYAtGets the highest non-empty (impassable) coordinate at the given coordinates.
getHighestBlockAtGets the highest non-empty (impassable) block at the given coordinates.
getHighestBlockAtGets the highest non-empty (impassable) block at the given Location.
getLoadedChunksGets a list of all loaded Chunks.
dropItemDrops an item at the specified Location.
spawnActorCreates an actor at the given Location.
getActorsGet a list of all actors in this dimension.

enumType

Type

Represents various dimension types.

Values

NameValueDescription
Overworld0
Nether1
TheEnd2
Custom999

meth~Dimensionvirtual

~Dimension() =default

methgetNameabstractconst

std::string getName() const =0

Gets the name of this dimension.

Returns

TypeDescription
std::stringName of this dimension

methgetTypeabstractconst

Type getType() const =0

Gets the type of this dimension.

Returns

TypeDescription
TypeType of this dimension

methgetLevelabstractconst

Level& getLevel() const =0

Gets the level to which this dimension belongs.

Returns

TypeDescription
Level&Level containing this dimension.

methgetBlockAtabstractconst

std::unique_ptr<Block> getBlockAt(int x, int y, int z) const =0

Gets the Block at the given coordinates.

Parameters

NameTypeDescription
xintX-coordinate of the block
yintY-coordinate of the block
zintZ-coordinate of the block

Returns

TypeDescription
std::unique_ptr<Block>Block at the given coordinates

methgetBlockAtabstractconst

std::unique_ptr<Block> getBlockAt(Location location) const =0

Gets the Block at the given Location.

Parameters

NameTypeDescription
locationLocationLocation of the block

Returns

TypeDescription
std::unique_ptr<Block>Block at the given coordinates

methgetHighestBlockYAtabstractconst

int getHighestBlockYAt(int x, int z) const =0

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

Parameters

NameTypeDescription
xintX-coordinate of the blocks
zintZ-coordinate of the blocks

Returns

TypeDescription
intY-coordinate of the highest non-empty block

methgetHighestBlockAtabstractconst

std::unique_ptr<Block> getHighestBlockAt(int x, int z) const =0

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

Parameters

NameTypeDescription
xintX-coordinate of the block
zintZ-coordinate of the block

Returns

TypeDescription
std::unique_ptr<Block>Highest non-empty block

methgetHighestBlockAtabstractconst

std::unique_ptr<Block> getHighestBlockAt(Location location) const =0

Gets the highest non-empty (impassable) block at the given Location.

Parameters

NameTypeDescription
locationLocationCoordinates to get the highest block

Returns

TypeDescription
std::unique_ptr<Block>Highest non-empty block

methgetLoadedChunksabstract

std::vector<std::unique_ptr<Chunk>> getLoadedChunks() =0

Gets a list of all loaded Chunks.

Returns

TypeDescription
std::vector<std::unique_ptr<Chunk>>All loaded chunks

methdropItemabstract

Item& dropItem(Location location, const ItemStack& item) =0

Drops an item at the specified Location.

Parameters

NameTypeDescription
locationLocationLocation to drop the item
itemconst ItemStack&ItemStack to drop

Returns

TypeDescription
Item&Item entity created as a result of this method

methspawnActorabstract

Actor* spawnActor(Location location, std::string type) =0

Creates an actor at the given Location.

Parameters

NameTypeDescription
locationLocationThe location to spawn the actor
typestd::stringThe actor to spawn

Returns

TypeDescription
Actor*Resulting Actor of this method

methgetActorsabstractconst

std::vector<Actor*> getActors() const =0

Get a list of all actors in this dimension.

Returns

TypeDescription
std::vector<Actor*>A List of all actors currently residing in this dimension

classLevel

Defined in <endstone/level/level.h>

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

Methods

NameDescription
~Level
getNameGets the unique name of this level.
getActorsGet a list of all actors in this level.
getTimeGets the relative in-game time of this level.
setTimeSets the relative in-game time on the server.
getDimensionsGets a list of all dimensions within this level.
getDimensionGets the dimension with the given name.
getSeedGets the Seed for this level.

meth~Levelvirtual

~Level() =default

methgetNameabstractconst

std::string getName() const =0

Gets the unique name of this level.

Returns

TypeDescription
std::stringName of this level

methgetActorsabstractconst

std::vector<Actor*> getActors() const =0

Get a list of all actors in this level.

Returns

TypeDescription
std::vector<Actor*>A List of all actors currently residing in this level

methgetTimeabstractconst

int getTime() const =0

Gets the relative in-game time of this level.

Returns

TypeDescription
intThe current relative time

methsetTimeabstract

void setTime(int time) =0

Sets the relative in-game time on the server.

Parameters

NameTypeDescription
timeintThe new relative time to set the in-game time to

methgetDimensionsabstractconst

std::vector<Dimension*> getDimensions() const =0

Gets a list of all dimensions within this level.

Returns

TypeDescription
std::vector<Dimension*>a list of dimensions

methgetDimensionabstractconst

Dimension* getDimension(std::string name) const =0

Gets the dimension with the given name.

Parameters

NameTypeDescription
namestd::stringthe name of the dimension to retrieve. For example, "overworld", "nether" or "the_end".

Returns

TypeDescription
Dimension*The Dimension with the given name, or nullptr if none exists

methgetSeedabstractconst

std::int64_t getSeed() const =0

Gets the Seed for this level.

Returns

TypeDescription
std::int64_tThis level's Seed

classLocation

Defined in <endstone/level/location.h>

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

Methods

NameDescription
Location
setDimensionSets the dimension that this position resides in.
getDimensionGets the dimension that this location resides in.
getBlockGets the block at the represented location.
setXSets the x-coordinate of this location.
getXGets the x-coordinate of this location.
getBlockXGets the floored value of the X component, indicating the block that this location is contained with.
setYSets the y-coordinate of this location.
getYGets the y-coordinate of this location.
getBlockYGets the floored value of the Y component, indicating the block that this location is contained with.
setZSets the z-coordinate of this location.
getZGets the z-coordinate of this location.
getBlockZGets the floored value of the Z component, indicating the block that this location is contained with.
getPitchGets the pitch of this location, measured in degrees.
setPitchSets the pitch of this location, measured in degrees.
getYawGets the yaw of this location, measured in degrees.
setYawSets the yaw of this location, measured in degrees.
getDirectionGets a unit-vector pointing in the direction that this Location is facing.
setDirectionSets the yaw and pitch to point in the direction of the vector.
lengthGets the magnitude of the location, defined as sqrt(x^2+y^2+z^2).
lengthSquaredGets the magnitude of the location squared.
distanceGet the distance between this location and another.
distanceSquaredGet the squared distance between this location and another.
operator+=
operator+=
operator-=
operator-=
operator*=
zeroZero this vector's components. Not world-aware.
operator==
operator!=
operator Vector
normalizeYawNormalizes the given yaw angle to a value between +/-180 degrees.
normalizePitchNormalizes the given pitch angle to a value between +/-90 degrees.

methLocation

Location(Dimension& dimension, T x, T y, T z, const float pitch = 0.0, const float yaw = 0.0)

methsetDimension

void setDimension(Dimension& dimension)

Sets the dimension that this position resides in.

Parameters

NameTypeDescription
dimensionDimension&New dimension that this position resides in

methgetDimensionconst

Dimension& getDimension() const

Gets the dimension that this location resides in.

Returns

TypeDescription
Dimension&Dimension that contains this location

methgetBlockconst

std::unique_ptr<Block> getBlock() const

Gets the block at the represented location.

Returns

TypeDescription
std::unique_ptr<Block>Block at the represented location

methsetXconstexpr

void setX(T x)

Sets the x-coordinate of this location.

Parameters

NameTypeDescription
xTX-coordinate

methgetXconstconstexpr

float getX() const

Gets the x-coordinate of this location.

Returns

TypeDescription
floatx-coordinate

methgetBlockXconst

int getBlockX() const

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

Returns

TypeDescription
intblock X

methsetYconstexpr

void setY(T y)

Sets the y-coordinate of this location.

Parameters

NameTypeDescription
yTy-coordinate

methgetYconstconstexpr

float getY() const

Gets the y-coordinate of this location.

Returns

TypeDescription
floaty-coordinate

methgetBlockYconst

int getBlockY() const

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

Returns

TypeDescription
intblock Y

methsetZconstexpr

void setZ(T z)

Sets the z-coordinate of this location.

Parameters

NameTypeDescription
zTz-coordinate

methgetZconstconstexpr

float getZ() const

Gets the z-coordinate of this location.

Returns

TypeDescription
floatz-coordinate

methgetBlockZconst

int getBlockZ() const

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

Returns

TypeDescription
intblock Z

methgetPitchconst

float getPitch() const

Gets the pitch of this location, measured in degrees.

Returns

TypeDescription
floatthe incline's pitch

methsetPitch

void setPitch(float pitch)

Sets the pitch of this location, measured in degrees.

  • A pitch of 0 represents level forward facing.
  • A pitch of 90 represents downward facing, or negative y direction.
  • A pitch of -90 represents upward facing, or positive y direction.

Increasing pitch values the equivalent of looking down.

Parameters

NameTypeDescription
pitchfloatnew incline's pitch

methgetYawconst

float getYaw() const

Gets the yaw of this location, measured in degrees.

Returns

TypeDescription
floatthe rotation's yaw

methsetYaw

void setYaw(float yaw)

Sets the yaw of this location, measured in degrees.

  • A yaw of 0 or 360 represents the positive z direction.
  • A yaw of 180 represents the negative z direction.
  • A yaw of 90 represents the negative x direction.
  • A yaw of 270 represents the positive x direction.

Increasing yaw values are the equivalent of turning to your right-facing, increasing the scale of the next respective axis, and decreasing the scale of the previous axis.

Parameters

NameTypeDescription
yawfloatnew rotation's yaw

methgetDirectionconst

Vector getDirection() const

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

Returns

TypeDescription
Vectora vector pointing the direction of this location's pitch and yaw

methsetDirection

Location& setDirection(const Vector& vector)

Sets the yaw and pitch to point in the direction of the vector.

Parameters

NameTypeDescription
vectorconst Vector&the direction vector

Returns

TypeDescription
Location&the same location

methlengthconst

float length() const

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

Not world-aware and orientation independent.

Returns

TypeDescription
floatthe magnitude

methlengthSquaredconstconstexpr

float lengthSquared() const

Gets the magnitude of the location squared.

Not world-aware and orientation independent.

Returns

TypeDescription
floatthe magnitude

methdistanceconst

float distance(const Location& other) const

Get the distance between this location and another.

Parameters

NameTypeDescription
otherconst Location&The other location

Returns

TypeDescription
floatthe distance

methdistanceSquaredconst

float distanceSquared(const Location& other) const

Get the squared distance between this location and another.

Parameters

NameTypeDescription
otherconst Location&The other location

Returns

TypeDescription
floatthe distance

methoperator+=

Location& operator+=(const Location& other)

methoperator+=

Location& operator+=(const Vector& other)

methoperator-=

Location& operator-=(const Location& other)

methoperator-=

Location& operator-=(const Vector& other)

methoperator*=

Location& operator*=(T scalar)

methzeroconstexpr

Location& zero()

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

Returns

TypeDescription
Location&the same location

methoperator==constnoexcept

bool operator==(const Location& other) const noexcept

methoperator!=constnoexcept

bool operator!=(const Location& other) const noexcept

methoperator Vectorconstnoexcept

operator Vector() const noexcept

methnormalizeYawstatic

float normalizeYaw(float yaw)

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

Parameters

NameTypeDescription
yawfloatthe yaw in degrees

Returns

TypeDescription
floatthe normalized yaw in degrees

methnormalizePitchstatic

float normalizePitch(float pitch)

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

Parameters

NameTypeDescription
pitchfloatthe pitch in degrees

Returns

TypeDescription
floatthe normalized pitch in degrees

On this page