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 Lever

Public Functions

std::string getMaterial()

Get the material of the block.

Return

string The block’s material

int getX()

Get the X coordinate of the block.

Return

int The x coordinate

int getY()

Get the Y coordinate of the block.

Return

int The y coordinate

int getZ()

Get the Z coordinate of the block.

Return

int The z coordinate

Pos &getPos()

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

Return

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 toSemanticMapJSON(nlohmann::json &json_base)

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

Return

nlohmann::json The base json

void toLowLevelMapJSON(nlohmann::json &json_base)

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

Return

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

~Block()

Destroy the Block object.

Protected Attributes

std::string material
Pos pos