Skip to Content
⚠ Under Construction
ReferenceC++ APIBlock

endstone::Block

Represents a block.

Functions:

NameDescription
captureStateCaptures the current state of this block.
cloneCreates a copy of the current block.
getDataGets the complete block data for this block.
getDimensionGets the dimension which contains this Block .
getLocationGets the Location of the block.
getRelativeGets the block at the given offsets.
getRelativeGets the block at the given face.
getRelativeGets the block at the given distance of the given face.
getTypeGet the type of the block.
getXGets the x-coordinate of this block.
getYGets the y-coordinate of this block.
getZGets the z-coordinate of this block.
setDataSets the complete data for this block.
setDataSets the complete data for this block.
setTypeSets the type of this block.
setTypeSets 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:

Block

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 offset
  • offset_y Y-coordinate offset
  • offset_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 return
  • distance 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 data
  • apply_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 to
  • apply_physics False to cancel physics on the changed block.
Last updated on