endstone/level
Classes
classChunk
Defined in <endstone/level/chunk.h>
Represents a chunk of blocks.
Methods
| Name | Description |
|---|---|
~Chunk | |
getX | Gets the X-coordinate of this chunk. |
getZ | Gets the Z-coordinate of this chunk. |
getLevel | Gets the level containing this chunk. |
getDimension | Gets the dimension containing this chunk. |
meth~Chunkvirtual
~Chunk() =defaultmethgetXabstractconst
int getX() const =0Gets the X-coordinate of this chunk.
Returns
| Type | Description |
|---|---|
int | X-coordinate |
methgetZabstractconst
int getZ() const =0Gets the Z-coordinate of this chunk.
Returns
| Type | Description |
|---|---|
int | Z-coordinate |
methgetLevelabstractconst
Level& getLevel() const =0Gets the level containing this chunk.
methgetDimensionabstractconst
Dimension& getDimension() const =0Gets the dimension containing this chunk.
classDimension
Defined in <endstone/level/dimension.h>
Represents a dimension within a Level.
Enums
| Name | Description |
|---|---|
Type | Represents various dimension types. |
Methods
| Name | Description |
|---|---|
~Dimension | |
getName | Gets the name of this dimension. |
getType | Gets the type of this dimension. |
getLevel | Gets the level to which this dimension belongs. |
getBlockAt | Gets the Block at the given coordinates. |
getBlockAt | Gets the Block at the given Location. |
getHighestBlockYAt | Gets the highest non-empty (impassable) coordinate at the given coordinates. |
getHighestBlockAt | Gets the highest non-empty (impassable) block at the given coordinates. |
getHighestBlockAt | Gets the highest non-empty (impassable) block at the given Location. |
getLoadedChunks | Gets a list of all loaded Chunks. |
dropItem | Drops an item at the specified Location. |
spawnActor | Creates an actor at the given Location. |
getActors | Get a list of all actors in this dimension. |
enumType
TypeRepresents various dimension types.
Values
| Name | Value | Description |
|---|---|---|
Overworld | 0 | |
Nether | 1 | |
TheEnd | 2 | |
Custom | 999 |
meth~Dimensionvirtual
~Dimension() =defaultmethgetNameabstractconst
std::string getName() const =0Gets the name of this dimension.
Returns
| Type | Description |
|---|---|
std::string | Name of this dimension |
methgetTypeabstractconst
Type getType() const =0Gets the type of this dimension.
methgetLevelabstractconst
Level& getLevel() const =0Gets the level to which this dimension belongs.
methgetBlockAtabstractconst
std::unique_ptr<Block> getBlockAt(int x, int y, int z) const =0Gets the Block at the given coordinates.
Parameters
| Name | Type | Description |
|---|---|---|
x | int | X-coordinate of the block |
y | int | Y-coordinate of the block |
z | int | Z-coordinate of the block |
Returns
| Type | Description |
|---|---|
std::unique_ptr<Block> | Block at the given coordinates |
methgetBlockAtabstractconst
std::unique_ptr<Block> getBlockAt(Location location) const =0Gets the Block at the given Location.
Returns
| Type | Description |
|---|---|
std::unique_ptr<Block> | Block at the given coordinates |
methgetHighestBlockYAtabstractconst
int getHighestBlockYAt(int x, int z) const =0Gets the highest non-empty (impassable) coordinate at the given coordinates.
Parameters
| Name | Type | Description |
|---|---|---|
x | int | X-coordinate of the blocks |
z | int | Z-coordinate of the blocks |
Returns
| Type | Description |
|---|---|
int | Y-coordinate of the highest non-empty block |
methgetHighestBlockAtabstractconst
std::unique_ptr<Block> getHighestBlockAt(int x, int z) const =0Gets the highest non-empty (impassable) block at the given coordinates.
Parameters
| Name | Type | Description |
|---|---|---|
x | int | X-coordinate of the block |
z | int | Z-coordinate of the block |
Returns
| Type | Description |
|---|---|
std::unique_ptr<Block> | Highest non-empty block |
methgetHighestBlockAtabstractconst
std::unique_ptr<Block> getHighestBlockAt(Location location) const =0Gets the highest non-empty (impassable) block at the given Location.
Parameters
| Name | Type | Description |
|---|---|---|
location | Location | Coordinates to get the highest block |
Returns
| Type | Description |
|---|---|
std::unique_ptr<Block> | Highest non-empty block |
methgetLoadedChunksabstract
std::vector<std::unique_ptr<Chunk>> getLoadedChunks() =0Gets a list of all loaded Chunks.
Returns
| Type | Description |
|---|---|
std::vector<std::unique_ptr<Chunk>> | All loaded chunks |
methdropItemabstract
Drops an item at the specified Location.
Parameters
methspawnActorabstract
Actor* spawnActor(Location location, std::string type) =0Creates an actor at the given Location.
Parameters
| Name | Type | Description |
|---|---|---|
location | Location | The location to spawn the actor |
type | std::string | The actor to spawn |
methgetActorsabstractconst
std::vector<Actor*> getActors() const =0Get a list of all actors in this dimension.
Returns
| Type | Description |
|---|---|
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
| Name | Description |
|---|---|
~Level | |
getName | Gets the unique name of this level. |
getActors | Get a list of all actors in this level. |
getTime | Gets the relative in-game time of this level. |
setTime | Sets the relative in-game time on the server. |
getDimensions | Gets a list of all dimensions within this level. |
getDimension | Gets the dimension with the given name. |
getSeed | Gets the Seed for this level. |
meth~Levelvirtual
~Level() =defaultmethgetNameabstractconst
std::string getName() const =0Gets the unique name of this level.
Returns
| Type | Description |
|---|---|
std::string | Name of this level |
methgetActorsabstractconst
std::vector<Actor*> getActors() const =0Get a list of all actors in this level.
Returns
| Type | Description |
|---|---|
std::vector<Actor*> | A List of all actors currently residing in this level |
methgetTimeabstractconst
int getTime() const =0Gets the relative in-game time of this level.
Returns
| Type | Description |
|---|---|
int | The current relative time |
methsetTimeabstract
void setTime(int time) =0Sets the relative in-game time on the server.
Parameters
| Name | Type | Description |
|---|---|---|
time | int | The new relative time to set the in-game time to |
methgetDimensionsabstractconst
std::vector<Dimension*> getDimensions() const =0Gets a list of all dimensions within this level.
Returns
| Type | Description |
|---|---|
std::vector<Dimension*> | a list of dimensions |
methgetDimensionabstractconst
Dimension* getDimension(std::string name) const =0Gets the dimension with the given name.
Parameters
| Name | Type | Description |
|---|---|---|
name | std::string | the name of the dimension to retrieve. For example, "overworld", "nether" or "the_end". |
methgetSeedabstractconst
std::int64_t getSeed() const =0Gets the Seed for this level.
Returns
| Type | Description |
|---|---|
std::int64_t | This level's Seed |
classLocation
Defined in <endstone/level/location.h>
Represents a 3-dimensional location in a dimension within a level.
Methods
| Name | Description |
|---|---|
Location | |
setDimension | Sets the dimension that this position resides in. |
getDimension | Gets the dimension that this location resides in. |
getBlock | Gets the block at the represented location. |
setX | Sets the x-coordinate of this location. |
getX | Gets the x-coordinate of this location. |
getBlockX | Gets the floored value of the X component, indicating the block that this location is contained with. |
setY | Sets the y-coordinate of this location. |
getY | Gets the y-coordinate of this location. |
getBlockY | Gets the floored value of the Y component, indicating the block that this location is contained with. |
setZ | Sets the z-coordinate of this location. |
getZ | Gets the z-coordinate of this location. |
getBlockZ | Gets the floored value of the Z component, indicating the block that this location is contained with. |
getPitch | Gets the pitch of this location, measured in degrees. |
setPitch | Sets the pitch of this location, measured in degrees. |
getYaw | Gets the yaw of this location, measured in degrees. |
setYaw | Sets the yaw of this location, measured in degrees. |
getDirection | Gets a unit-vector pointing in the direction that this Location is facing. |
setDirection | Sets the yaw and pitch to point in the direction of the vector. |
length | Gets the magnitude of the location, defined as sqrt(x^2+y^2+z^2). |
lengthSquared | Gets the magnitude of the location squared. |
distance | Get the distance between this location and another. |
distanceSquared | Get the squared distance between this location and another. |
operator+= | |
operator+= | |
operator-= | |
operator-= | |
operator*= | |
zero | Zero this vector's components. Not world-aware. |
operator== | |
operator!= | |
operator Vector | |
normalizeYaw | Normalizes the given yaw angle to a value between +/-180 degrees. |
normalizePitch | Normalizes 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
| Name | Type | Description |
|---|---|---|
dimension | Dimension& | New dimension that this position resides in |
methgetDimensionconst
Dimension& getDimension() constGets the dimension that this location resides in.
methgetBlockconst
std::unique_ptr<Block> getBlock() constGets the block at the represented location.
Returns
| Type | Description |
|---|---|
std::unique_ptr<Block> | Block at the represented location |
methsetXconstexpr
void setX(T x)Sets the x-coordinate of this location.
Parameters
| Name | Type | Description |
|---|---|---|
x | T | X-coordinate |
methgetXconstconstexpr
float getX() constGets the x-coordinate of this location.
Returns
| Type | Description |
|---|---|
float | x-coordinate |
methgetBlockXconst
int getBlockX() constGets the floored value of the X component, indicating the block that this location is contained with.
Returns
| Type | Description |
|---|---|
int | block X |
methsetYconstexpr
void setY(T y)Sets the y-coordinate of this location.
Parameters
| Name | Type | Description |
|---|---|---|
y | T | y-coordinate |
methgetYconstconstexpr
float getY() constGets the y-coordinate of this location.
Returns
| Type | Description |
|---|---|
float | y-coordinate |
methgetBlockYconst
int getBlockY() constGets the floored value of the Y component, indicating the block that this location is contained with.
Returns
| Type | Description |
|---|---|
int | block Y |
methsetZconstexpr
void setZ(T z)Sets the z-coordinate of this location.
Parameters
| Name | Type | Description |
|---|---|---|
z | T | z-coordinate |
methgetZconstconstexpr
float getZ() constGets the z-coordinate of this location.
Returns
| Type | Description |
|---|---|
float | z-coordinate |
methgetBlockZconst
int getBlockZ() constGets the floored value of the Z component, indicating the block that this location is contained with.
Returns
| Type | Description |
|---|---|
int | block Z |
methgetPitchconst
float getPitch() constGets the pitch of this location, measured in degrees.
Returns
| Type | Description |
|---|---|
float | the 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
| Name | Type | Description |
|---|---|---|
pitch | float | new incline's pitch |
methgetYawconst
float getYaw() constGets the yaw of this location, measured in degrees.
Returns
| Type | Description |
|---|---|
float | the 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
| Name | Type | Description |
|---|---|---|
yaw | float | new rotation's yaw |
methgetDirectionconst
Vector getDirection() constGets a unit-vector pointing in the direction that this Location is facing.
Returns
| Type | Description |
|---|---|
Vector | a vector pointing the direction of this location's pitch and yaw |
methsetDirection
Sets the yaw and pitch to point in the direction of the vector.
Parameters
| Name | Type | Description |
|---|---|---|
vector | const Vector& | the direction vector |
Returns
| Type | Description |
|---|---|
Location& | the same location |
methlengthconst
float length() constGets the magnitude of the location, defined as sqrt(x^2+y^2+z^2).
Not world-aware and orientation independent.
Returns
| Type | Description |
|---|---|
float | the magnitude |
methlengthSquaredconstconstexpr
float lengthSquared() constGets the magnitude of the location squared.
Not world-aware and orientation independent.
Returns
| Type | Description |
|---|---|
float | the magnitude |
methdistanceconst
float distance(const Location& other) constGet the distance between this location and another.
Parameters
| Name | Type | Description |
|---|---|---|
other | const Location& | The other location |
Returns
| Type | Description |
|---|---|
float | the distance |
methdistanceSquaredconst
float distanceSquared(const Location& other) constGet the squared distance between this location and another.
Parameters
| Name | Type | Description |
|---|---|---|
other | const Location& | The other location |
Returns
| Type | Description |
|---|---|
float | the distance |
methoperator+=
methoperator+=
methoperator-=
methoperator-=
methoperator*=
Location& operator*=(T scalar)methzeroconstexpr
Location& zero()Zero this vector's components. Not world-aware.
Returns
| Type | Description |
|---|---|
Location& | the same location |
methoperator==constnoexcept
bool operator==(const Location& other) const noexceptmethoperator!=constnoexcept
bool operator!=(const Location& other) const noexceptmethoperator Vectorconstnoexcept
operator Vector() const noexceptmethnormalizeYawstatic
float normalizeYaw(float yaw)Normalizes the given yaw angle to a value between +/-180 degrees.
Parameters
| Name | Type | Description |
|---|---|---|
yaw | float | the yaw in degrees |
Returns
| Type | Description |
|---|---|
float | the normalized yaw in degrees |
methnormalizePitchstatic
float normalizePitch(float pitch)Normalizes the given pitch angle to a value between +/-90 degrees.
Parameters
| Name | Type | Description |
|---|---|---|
pitch | float | the pitch in degrees |
Returns
| Type | Description |
|---|---|
float | the normalized pitch in degrees |