Class World

Class Documentation

class World

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

This class represents a Minecraft world as a list of axis aligned bounding boxes and blocks.

Public Functions

std::vector<std::unique_ptr<AABB>> &getAABBList()

Returns the vector that holds the AABBs. Do not transfer ownership of any unique_ptr as it may cause scope issues.

Returns

vector<AABB*>& The AABB list.

std::vector<std::unique_ptr<Block>> &getBlockList()

Returns the vector that holds the Blocks. Do not transfer ownership of any unique_ptr as it may cause scope issues.

Returns

vector<Block*>& The Block list.

std::vector<std::unique_ptr<Entity>> &getEntityList()

Returns the Entity vector for this World. Do not transfer ownership of any unique_ptr as it may cause scope issues.

Returns

std::vector<Entity*>& The Entity list.

std::vector<std::unique_ptr<Object>> &getObjectList()

Returns the Object vector for this World. Do not transfer ownership of any unique_ptr as it may cause scope issues.

Returns

std::vector<Object*>& The object list.

std::vector<std::unique_ptr<Connection>> &getConnectionList()

Returns the Connection vector for this World. Do not transfer ownership of any unique_ptr as it may cause scope issues.

Returns

std::vector<Connection*>& The connection list.

void addAABB(std::unique_ptr<AABB> aabb)

Add an AABB to the vector of AABB held inside the world.

Parameters

aabb – The AABB to add.

void addEntity(std::unique_ptr<Entity> entity)

Add an Entity for this world to keep track of.

Parameters

entity – The Entity object.

void addBlock(std::unique_ptr<Block> block)

Add a Block to the vector of Block held inside the world.

Parameters

block – The Block to add.

void addObject(std::unique_ptr<Object> object)

Add an object to the vector of object held inside the world.

Parameters

object – The object to add.

void addConnection(std::unique_ptr<Connection> connection)

Add an connection to the vector of connection held inside the world.

Parameters

connection – The connection to add.

virtual std::string toLowLevelMapJSON()

Converts the world into its alternate JSON representation with each entry indented by 4 and returns the string representation of it.

Returns

string The JSON as a string.

virtual std::string toSemanticMapJSON()

Converts the world into a JSON representation with each entry indented by 4 and returns the string representation of it.

Returns

string The JSON as a string.

void writeToFile(std::string jsonPath, std::string lowLevelMapJSONPath)

Writes the world’s JSON and alternate JSON output to the given filepaths.

Parameters
  • jsonPath – Path to store json.

  • lowLevelMapJSONPath – Path to store the alternate json representation.

World()

Construct a new World object.

std::mt19937_64 &getRandom()

Get the random object used by this generator.

Returns

std::mt19937_64& The random object.

void setRandom(int seed)

Set the seed the random object used by this class is initialized with.

Parameters

seed – The seed to use.

virtual ~World()

Destroy the World object.