VoxelEngine
 
Loading...
Searching...
No Matches
engine::MultiBlock Class Reference

A MultiBlock represents multiple blocks at the same position. More...

#include <MultiBlock.h>

Classes

struct  SubBlock
 

Public Member Functions

 MultiBlock ()=default
 
SubBlock toBlock () const
 Converts a MultiBlock to a block and its state.
 
bool hasBlock (BlockID blockID) const
 
bool addBlock (SubBlock block)
 
void removeBlock (uint8_t index)
 
const std::vector< SubBlock > & blocks () const
 
std::vector< BlockID > blockIDs () const
 
uint8_t blockCount () const
 

Static Public Member Functions

static MultiBlock fromBlock (BlockID, BlockState *state)
 Converts a block and its state to a multi-block.
 

Protected Member Functions

 MultiBlock (std::initializer_list< SubBlock > blocks)
 

Detailed Description

A MultiBlock represents multiple blocks at the same position.

Note
Each block can also have it's own state, just like normal blocks.
It can have up to 15 blocks.
It can have Blocks and VariantBlocks.
Warning
It is user's responsibility to ensure the blocks make sense together (visibility, overlapping, z-fighting, etc.)

Constructor & Destructor Documentation

◆ MultiBlock()

engine::MultiBlock::MultiBlock ( )
default
Note
Default constructor should not be used. Use fromBlock to create a MultiBlock.

Member Function Documentation

◆ fromBlock()

MultiBlock MultiBlock::fromBlock ( BlockID  blockID,
BlockState state 
)
static

Converts a block and its state to a multi-block.

Parameters
blockIDThe ID of the block to convert.
stateThe state of the block to convert.

◆ toBlock()

MultiBlock::SubBlock MultiBlock::toBlock ( ) const

Converts a MultiBlock to a block and its state.

Note
Makes the first subblock the base block.
Returns
SubBlock consisting from BlockID and its state. If MultiBlock is empty, returns air, if MultiBlock has more than one SubBlocks, returns the first SubBlock.

The documentation for this class was generated from the following files: