Class endstone::Block¶
Represents a block. More...
#include <endstone/block/block.h>
Public Functions¶
Type | Name |
---|---|
virtual std::shared_ptr< BlockState > | captureState () const = 0 |
virtual Result< std::shared_ptr< BlockData > > | getData () const = 0 Gets the complete block data for this block. |
virtual Dimension & | getDimension () const = 0 Gets the dimension which contains this Block . |
virtual Location | getLocation () const = 0 Gets the Location of the block. |
virtual Result< std::unique_ptr< Block > > | getRelative (int offset_x, int offset_y, int offset_z) = 0 Gets the block at the given offsets. |
virtual Result< std::unique_ptr< Block > > | getRelative (BlockFace face) = 0 Gets the block at the given face. |
virtual Result< std::unique_ptr< Block > > | getRelative (BlockFace face, int distance) = 0 Gets the block at the given distance of the given face. |
virtual Result< std::string > | getType () const = 0 Get the type of the block. |
virtual int | getX () const = 0 Gets the x-coordinate of this block. |
virtual int | getY () const = 0 Gets the y-coordinate of this block. |
virtual int | getZ () const = 0 Gets the z-coordinate of this block. |
virtual bool | isValid () const = 0 Checks if the block is valid. |
virtual Result< void > | setData (std::shared_ptr< BlockData > data) = 0 Sets the complete data for this block. |
virtual Result< void > | setData (std::shared_ptr< BlockData > data, bool apply_physics) = 0 Sets the complete data for this block. |
virtual Result< void > | setType (std::string type) = 0 Sets the type of this block. |
virtual Result< void > | setType (std::string type, bool apply_physics) = 0 Sets the type of this block. |
virtual | ~Block () = default |
Detailed Description¶
This is a live object, and only one Block may exist for any given location in a dimension.
Public Functions Documentation¶
function captureState¶
Captures the current state of this block.
The returned object will never be updated, and you are not guaranteed that (for example) a sign is still a sign after you capture its state.
Returns:
BlockState with the current state of this block.
function getData¶
Gets the complete block data for this block.
Returns:
block specific data
function getDimension¶
Gets the dimension which contains this Block .
Returns:
Dimension containing this block
function getLocation¶
Gets the Location of the block.
Returns:
Location of block
function getRelative [⅓]¶
Gets the block at the given offsets.
virtual Result< std::unique_ptr< Block > > endstone::Block::getRelative (
int offset_x,
int offset_y,
int offset_z
) = 0
Parameters:
offset_x
X-coordinate offsetoffset_y
Y-coordinate offsetoffset_z
Z-coordinate offset
Returns:
Block at the given offsets
function getRelative [⅔]¶
Gets the block at the given face.
This method is equal to getRelative(face, 1)
Parameters:
face
Face of this block to return
Returns:
Block at the given face
function getRelative [3/3]¶
Gets the block at the given distance of the given face.
virtual Result< std::unique_ptr< Block > > endstone::Block::getRelative (
BlockFace face,
int distance
) = 0
Parameters:
face
Face of this block to returndistance
Distance to get the block at
Returns:
Block at the given face
function getType¶
Get the type of the block.
This method returns the type of the block as a string, for example, minecraft:acacia_stairs.
Returns:
The type of the block.
function getX¶
Gets the x-coordinate of this block.
Returns:
x-coordinate
function getY¶
Gets the y-coordinate of this block.
Returns:
x-coordinate
function getZ¶
Gets the z-coordinate of this block.
Returns:
x-coordinate
function isValid¶
Checks if the block is valid.
This method verifies the validity of the block. A block is considered valid if and only if the chunk containing this block is loaded and ticking. If the chunk is not loaded or not in the ticking state, this method will return false.
Returns:
true if the block is valid (i.e., the containing chunk is loaded and ticking), otherwise false.
function setData [½]¶
Sets the complete data for this block.
Parameters:
data
new block specific data
function setData [2/2]¶
Sets the complete data for this block.
virtual Result< void > endstone::Block::setData (
std::shared_ptr< BlockData > data,
bool apply_physics
) = 0
Parameters:
data
new block specific dataapply_physics
False to cancel physics on the changed block.
function setType [½]¶
Sets the type of this block.
Parameters:
type
Material to change this block to
function setType [2/2]¶
Sets the type of this block.
Parameters:
type
Material to change this block toapply_physics
False to cancel physics on the changed block.
function ~Block¶
The documentation for this class was generated from the following file include/endstone/block/block.h