Class Block

Inheritance Relationships

Derived Type

Class Documentation

class Block

This file defines the members and methods implemented as part of the Block class.

This class represents a Minecraft block.

Subclassed by Door

Public Functions

std::string getMaterial()

Get the material of the block.

Returns:

string The block’s material.

int getX()

Get the X coordinate of the block.

Returns:

int The x coordinate.

int getY()

Get the Y coordinate of the block.

Returns:

int The y coordinate.

int getZ()

Get the Z coordinate of the block.

Returns:

int The z coordinate.

Pos &getPos()

Get the Pos object representation of the coordinates of the block.

Returns:

Pos& The pos representation.

void setX(int x)

Set the x value of this object.

Parameters:

x – The value to set to.

void setY(int y)

Set the y value of this object.

Parameters:

y – The value to set to.

void setZ(int z)

Set the z value of this object.

Parameters:

z – The value to set to.

void shiftX(int shift)

Shift the x value by a given amount.

Parameters:

shift – The amount to shift by which may be positive or negative

void shiftY(int shift)

Shift the y value by a given amount.

Parameters:

shift – The amount to shift by which may be positive or negative

void shiftZ(int shift)

Shift the z value by a given amount.

Parameters:

shift – The amount to shift by which may be positive or negative

void shift(int shiftX, int shiftY, int shiftZ)

Shift the x,y and z values by given amounts.

Parameters:
  • shiftX – The amount to shift x by which may be positive or negative

  • shiftY – The amount to shift x by which may be positive or negative

  • shiftZ – The amount to shift x by which may be positive or negative

virtual void toSemanticMapJSON(nlohmann::json &json_base)

Adds the JSON representation of this object to the “locations” list of the base json.

Returns:

nlohmann::json The base json.

virtual void toLowLevelMapJSON(nlohmann::json &json_base)

Adds the alternate JSON representation of this object to the “blocks” list of the base json.

Returns:

nlohmann::json The base json.

Block(std::string material, Pos &pos)

Construct a new Block object.

Parameters:
  • material – The material the block is made of.

  • pos – The position of the block in the Minecraft world.

virtual ~Block()

Destroy the Block object.

Protected Attributes

std::string material
Pos pos