mcpp
C++ Minecraft Library
Loading...
Searching...
No Matches
mcpp::Chunk Struct Reference

#include <chunk.h>

Classes

struct  ConstIterator
 An iterator for the const Chunk's 3D block data. More...
 
struct  Iterator
 An iterator for the Chunk's 3D block data. More...
 

Public Member Functions

 Chunk (const Coordinate &loc1, const Coordinate &loc2, const std::vector< BlockType > &block_list)
 
 ~Chunk ()=default
 
 Chunk (const Chunk &other)
 
 Chunk (Chunk &&other) noexcept=default
 
Chunkoperator= (const Chunk &other)
 
Chunkoperator= (Chunk &&other)=default
 
BlockType get_worldspace (const Coordinate &pos) const
 
BlockType get (int x, int y, int z) const
 
uint16_t x_len () const
 
uint16_t y_len () const
 
uint16_t z_len () const
 
Coordinate base_pt () const
 
Iterator begin ()
 
Iterator end ()
 
ConstIterator begin () const
 
ConstIterator end () const
 

Detailed Description

Stores a 3D cuboid of BlockTypes while preserving their relative location to the base point they were gathered at and each other.

Constructor & Destructor Documentation

◆ Chunk() [1/3]

mcpp::Chunk::Chunk ( const Coordinate loc1,
const Coordinate loc2,
const std::vector< BlockType > &  block_list 
)

◆ ~Chunk()

mcpp::Chunk::~Chunk ( )
default

◆ Chunk() [2/3]

mcpp::Chunk::Chunk ( const Chunk other)
inline

◆ Chunk() [3/3]

mcpp::Chunk::Chunk ( Chunk &&  other)
defaultnoexcept

Member Function Documentation

◆ base_pt()

Coordinate mcpp::Chunk::base_pt ( ) const

Gets the minimum coordinate in the Chunk.

Returns
the minimum coordinate in the Chunk

◆ begin() [1/2]

Iterator mcpp::Chunk::begin ( )
inline

◆ begin() [2/2]

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

◆ end() [1/2]

Iterator mcpp::Chunk::end ( )
inline

◆ end() [2/2]

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

◆ get()

BlockType mcpp::Chunk::get ( int  x,
int  y,
int  z 
) const

Local equivalent of get_worldspace, equivalent to a 3D array access of the internal data.

Parameters
xx element of array access
yy element of array access
zz element of array access
Returns
BlockType at specified location

◆ get_worldspace()

BlockType mcpp::Chunk::get_worldspace ( const Coordinate pos) const

Accesses the Minecraft block at absolute position pos and returns its BlockType if it is in the included area.

Parameters
posAbolute position in the Minecraft world to query BlockType for
Returns
BlockType at specified location

◆ operator=() [1/2]

Chunk & mcpp::Chunk::operator= ( Chunk &&  other)
default

◆ operator=() [2/2]

Chunk & mcpp::Chunk::operator= ( const Chunk other)

◆ x_len()

uint16_t mcpp::Chunk::x_len ( ) const

Gets the x length of the Chunk.

Returns
x length of the Chunk

◆ y_len()

uint16_t mcpp::Chunk::y_len ( ) const

Gets the y length of the Chunk.

Returns
y length of the Chunk

◆ z_len()

uint16_t mcpp::Chunk::z_len ( ) const

Gets the z length of the Chunk.

Returns
z length of the Chunk

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