endstone::Block
Represents a block.
Functions:
Name | Description |
---|---|
captureState | Captures the current state of this block. |
clone | Creates a copy of the current block. |
getData | Gets the complete block data for this block. |
getDimension | Gets the dimension which contains this Block . |
getLocation | Gets the Location of the block. |
getRelative | Gets the block at the given offsets. |
getRelative | Gets the block at the given face. |
getRelative | Gets the block at the given distance of the given face. |
getType | Get the type of the block. |
getX | Gets the x-coordinate of this block. |
getY | Gets the y-coordinate of this block. |
getZ | Gets the z-coordinate of this block. |
setData | Sets the complete data for this block. |
setData | Sets the complete data for this block. |
setType | Sets the type of this block. |
setType | Sets the type of this block. |
captureState
std::unique_ptr<BlockState> captureState() const
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.
clone
std::unique_ptr<Block> clone() const
Creates a copy of the current block.
Returns:
getData
std::unique_ptr<BlockData> getData() const
Gets the complete block data for this block.
Returns:
block specific data
getDimension
Dimension &getDimension() const
Gets the dimension which contains this Block .
Returns:
Dimension containing this block
getLocation
Location getLocation() const
Gets the Location of the block.
Returns:
Location of block
getRelative
std::unique_ptr<Block> getRelative(int offset_x, int offset_y, int offset_z)
Gets the block at the given offsets.
Parameters:
offset_x
X-coordinate offsetoffset_y
Y-coordinate offsetoffset_z
Z-coordinate offset
Returns:
Block at the given offsets
std::unique_ptr<Block> getRelative(BlockFace face)
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
std::unique_ptr<Block> getRelative(BlockFace face, int distance)
Gets the block at the given distance of the given face.
Parameters:
face
Face of this block to returndistance
Distance to get the block at
Returns:
Block at the given face
getType
std::string getType() const
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.
getX
int getX() const
Gets the x-coordinate of this block.
Returns:
x-coordinate
getY
int getY() const
Gets the y-coordinate of this block.
Returns:
x-coordinate
getZ
int getZ() const
Gets the z-coordinate of this block.
Returns:
x-coordinate
setData
Result<void> setData(const BlockData &data)
Sets the complete data for this block.
Parameters:
data
new block specific data
Result<void> setData(const BlockData &data, bool apply_physics)
Sets the complete data for this block.
Parameters:
data
new block specific dataapply_physics
False to cancel physics on the changed block.
setType
Result<void> setType(std::string type)
Sets the type of this block.
Parameters:
type
Material to change this block to
Result<void> setType(std::string type, bool apply_physics)
Sets the type of this block.
Parameters:
type
Material to change this block toapply_physics
False to cancel physics on the changed block.