mcpp
C++ Minecraft Library
mcpp::HeightMap Struct Reference

#include <util.h>

Classes

struct  ConstIterator
 An iterator for the const HeightMap structure. More...
 
struct  Iterator
 An iterator for the HeightMap structure. More...
 

Public Member Functions

Iterator begin ()
 
Iterator end ()
 
ConstIterator begin () const
 
ConstIterator end () const
 
 HeightMap (const Coordinate &loc1, const Coordinate &loc2, const std::vector< int > &heights)
 
 ~HeightMap ()
 
HeightMapoperator= (const HeightMap &other) noexcept
 
int get (int x, int z) const
 
int get_worldspace (const Coordinate &loc) const
 
void fill_coord (Coordinate &out) const
 
int x_len () const
 
int z_len () const
 
Coordinate base_pt () const
 

Detailed Description

Represents a 2D area of the world with the y coordinates of the highest non-air blocks at each (x,z)

Constructor & Destructor Documentation

◆ HeightMap()

mcpp::HeightMap::HeightMap ( const Coordinate loc1,
const Coordinate loc2,
const std::vector< int > &  heights 
)

◆ ~HeightMap()

mcpp::HeightMap::~HeightMap ( )

Member Function Documentation

◆ base_pt()

Coordinate mcpp::HeightMap::base_pt ( ) const

Gets the minimum coordinate in the HeightMap.

Returns
the minimum coordinate in the HeightMap.

◆ begin() [1/2]

Iterator mcpp::HeightMap::begin ( )
inline

◆ begin() [2/2]

ConstIterator mcpp::HeightMap::begin ( ) const
inline

◆ end() [1/2]

Iterator mcpp::HeightMap::end ( )
inline

◆ end() [2/2]

ConstIterator mcpp::HeightMap::end ( ) const
inline

◆ fill_coord()

void mcpp::HeightMap::fill_coord ( Coordinate out) const

Fill a coordinate inplace with the highest y coordinate at the loc's x and z components.

Parameters
locCoordinate to fill y value for

◆ get()

int mcpp::HeightMap::get ( int  x,
int  z 
) const

Get the height using an offset from the origin/base point of the heights area

Parameters
xx offset to access underlying array
zz offset to access underlying array
Returns
: height at specified offset

◆ get_worldspace()

int mcpp::HeightMap::get_worldspace ( const Coordinate loc) const

Get the height at a Minecraft coordinate if saved inside the height map

Parameters
locCoordinate in Minecraft world to access in the map
Returns
: height at specified coordinate

◆ operator=()

HeightMap& mcpp::HeightMap::operator= ( const HeightMap other)
noexcept

◆ x_len()

int mcpp::HeightMap::x_len ( ) const

Gets the x length of the HeightMap.

Returns
x length of the HeightMap

◆ z_len()

int mcpp::HeightMap::z_len ( ) const

Gets the z length of the HeightMap.

Returns
z length of the HeightMap

The documentation for this struct was generated from the following file: