Class endstone::Location¶
ClassList > endstone > Location
Represents a 3-dimensional location in a dimension within a level.
#include <endstone/level/location.h>
Inherits the following classes: endstone::Vector
Public Functions¶
Type | Name |
---|---|
Location (T x, T y, T z, const float pitch=0.0, const float yaw=0.0) |
|
Location (T x, T y, T z, Dimension & dimension) |
|
Location (T x, T y, T z, const float pitch, Dimension & dimension) |
|
Location (T x, T y, T z, const float pitch, const float yaw, Dimension & dimension) |
|
int | getBlockX () const Gets the floored value of the X component, indicating the block that this location is contained with. |
int | getBlockY () const Gets the floored value of the Y component, indicating the block that this location is contained with. |
int | getBlockZ () const Gets the floored value of the Z component, indicating the block that this location is contained with. |
Dimension * | getDimension () const Gets the dimension that this position resides in. |
Vector | getDirection () const Gets a unit-vector pointing in the direction that this Location is facing. |
float | getPitch () const Gets the pitch of this location, measured in degrees. |
float | getYaw () const Gets the yaw of this location, measured in degrees. |
void | setDimension (Dimension & dimension) Sets the dimension that this position resides in. |
void | setPitch (float pitch) Sets the pitch of this location, measured in degrees. |
void | setYaw (float yaw) Sets the yaw of this location, measured in degrees. |
Public Functions inherited from endstone::Vector¶
See endstone::Vector
Type | Name |
---|---|
constexpr | Vector () = default Construct the vector with all components as 0. |
constexpr | Vector (T x, T y, T z) Construct the vector with provided components. |
float | distance (const Vector & other) const |
constexpr float | distanceSquared (const Vector & other) const |
constexpr float | getX () const Gets the X component. |
constexpr float | getY () const Gets the Y component. |
constexpr float | getZ () const Gets the Z component. |
float | length () const Gets the magnitude of the vector, defined as sqrt(x2+y2+z^2). |
constexpr float | lengthSquared () const Gets the magnitude of the vector squared. |
Vector & | normalize () |
constexpr Vector | operator* (const Vector & other) const |
Vector | operator* (float scalar) const |
Vector & | operator*= (const Vector & other) |
constexpr Vector | operator+ (const Vector & other) const |
Vector | operator+ (float scalar) const |
Vector & | operator+= (const Vector & other) |
constexpr Vector | operator- (const Vector & other) const |
Vector | operator- (float scalar) const |
Vector & | operator-= (const Vector & other) |
constexpr Vector | operator/ (const Vector & other) const |
Vector | operator/ (float scalar) const |
Vector & | operator/= (const Vector & other) |
constexpr bool | operator== (const Vector & other) const |
constexpr void | setX (float x) Set the X component. |
constexpr void | setY (float y) Set the Y component. |
constexpr void | setZ (float z) Set the Z component. |
Protected Attributes inherited from endstone::Vector¶
See endstone::Vector
Type | Name |
---|---|
float | x_ = 0.0 |
float | y_ = 0.0 |
float | z_ = 0.0 |
Public Functions Documentation¶
function Location [¼]¶
template<typename T, typename>
inline endstone::Location::Location (
T x,
T y,
T z,
const float pitch=0.0,
const float yaw=0.0
)
function Location [2/4]¶
template<typename T, typename>
inline endstone::Location::Location (
T x,
T y,
T z,
Dimension & dimension
)
function Location [¾]¶
template<typename T, typename>
inline endstone::Location::Location (
T x,
T y,
T z,
const float pitch,
Dimension & dimension
)
function Location [4/4]¶
template<typename T, typename>
inline endstone::Location::Location (
T x,
T y,
T z,
const float pitch,
const float yaw,
Dimension & dimension
)
function getBlockX¶
Gets the floored value of the X component, indicating the block that this location is contained with.
Returns:
block X
function getBlockY¶
Gets the floored value of the Y component, indicating the block that this location is contained with.
Returns:
block Y
function getBlockZ¶
Gets the floored value of the Z component, indicating the block that this location is contained with.
Returns:
block Z
function getDimension¶
Gets the dimension that this position resides in.
Returns:
Dimension that contains this position, or nullptr if the dimension is not set.
function getDirection¶
Gets a unit-vector pointing in the direction that this Location is facing.
Returns:
a vector pointing the direction of this location's pitch and yaw
function getPitch¶
Gets the pitch of this location, measured in degrees.
Returns:
the incline's pitch
function getYaw¶
Gets the yaw of this location, measured in degrees.
Returns:
the rotation's yaw
function setDimension¶
Sets the dimension that this position resides in.
Parameters:
dimension
New dimension that this position resides in
function setPitch¶
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:
pitch
new incline's pitch
function setYaw¶
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:
yaw
new rotation's yaw
The documentation for this class was generated from the following file include/endstone/level/location.h