Class Entity

Class Documentation

class Entity

This class represents an Entity in Minecraft. The equipment is represented as a vector of size 5 with the helmet, chestplate, leggings, boots and weapon materials to assign.

Public Functions

std::string getMobType()

Get the mob type.

Returns

std::string The type.

int getX()

Get the x coordinate.

Returns

int The coordinate.

int getY()

Get the y coordinate.

Returns

int The coordinate.

int getZ()

Get the z coordinate.

Returns

int The coordinate.

void setX(int x)

Set the x coordinate.

Parameters

x – The new coordinate.

void setY(int y)

Set the y coordinate.

Parameters

y – The new coordinate.

void setZ(int z)

Set the z coordinate.

Parameters

z – The new coordinate.

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

std::string getHelmet()

Get the helmet’s material.

Returns

string The material.

std::string getChestplate()

Get the chestplate’s material.

Returns

string The material.

std::string getLeggings()

Get the leggings’ material.

Returns

string The material.

std::string getBoots()

Get the boots’ material.

Returns

string The material.

std::string getWeapon()

Get the weapon’s material.

Returns

string The material.

void setHelmet(std::string helmet)

Set the helmet’s material.

Parameters

helmet – The new material.

void setChestplate(std::string chestplate)

Set the chestplate’s material.

Parameters

chestplate – The new material.

void setLeggings(std::string leggings)

Set the leggings’ material.

Parameters

leggings – The new material.

void setBoots(std::string boots)

Set the boots’ material.

Parameters

boots – The new material.

void setWeapon(std::string weapon)

Set the weapon’s material.

Parameters

weapon – The new material.

void setMobType(std::string mobType)

Set the mob type.

Parameters

mobType – The new type.

void setAllEquipment(std::vector<std::string> &equipment)

Set materials for all the equipment. If the size of the input vector is too small or large nothing happens.

Parameters

equipment – A vector of size 5 with the helmet, chestplate, leggings, boots and weapon materials to assign.

virtual void toSemanticMapJSON(nlohmann::json &json_base)

Adds the JSON representation of this object to the “entities” 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 “entities” list of the base json.

Returns

nlohmann::json The base json.

Entity(std::string mobType, Pos &pos, std::string helmet = "none", std::string chestplate = "none", std::string leggings = "none", std::string boots = "none", std::string weapon = "none")

Construct a new Entity object. The material level values are interpreted on the Java side.

Parameters
  • mobType – What kind of mob is it.

  • pos – Where the mob should be placed.

  • helmet – Helmet’s material level.

  • chestplate – Chestplate’s material level.

  • leggings – Leggings’s material level.

  • boots – Boots’s material level.

  • weapon – Weapons’s material level.

virtual ~Entity()

Destroy the Entity object.