mcpp
C++ Minecraft Library
Loading...
Searching...
No Matches
mcpp::BlockType Class Reference

#include <block.h>

Public Member Functions

constexpr BlockType (uint8_t id=0, uint8_t mod=0)
 
bool operator== (const BlockType &other) const
 Equality comparison operator.
 
bool operator!= (const BlockType &other) const
 Inequality comparison operator.
 
BlockType with_mod (uint8_t modifier) const
 

Public Attributes

uint8_t id
 
uint8_t mod
 

Friends

std::ostream & operator<< (std::ostream &out, const BlockType &block)
 Stream insertion operator for outputting the BlockType to an output stream.
 

Constructor & Destructor Documentation

◆ BlockType()

constexpr mcpp::BlockType::BlockType ( uint8_t  id = 0,
uint8_t  mod = 0 
)
inlineconstexpr

Member Function Documentation

◆ operator!=()

bool mcpp::BlockType::operator!= ( const BlockType other) const

Inequality comparison operator.

Watch out as this also compares the BlockType.mod element of the block, so some equalities may behave in unexpected ways e.g. rotated stairs

Parameters
otherThe BlockType to compare with the current instance.
Returns
True if the two BlockType instances are not equal, false otherwise.

◆ operator==()

bool mcpp::BlockType::operator== ( const BlockType other) const

Equality comparison operator.

Watch out as this also compares the BlockType.mod element of the block, so some equalities may behave in unexpected ways e.g. rotated stairs

Parameters
otherThe BlockType to compare with the current instance.
Returns
True if the two BlockType instances are not equal, false otherwise.

◆ with_mod()

BlockType mcpp::BlockType::with_mod ( uint8_t  modifier) const

Returns a new BlockType with the same id and specified modifier, useful for rotations etc.

Parameters
modifierNew modifier for the BlockType
Returns
New BlockType object with the specified modifier

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const BlockType block 
)
friend

Stream insertion operator for outputting the BlockType to an output stream.

Parameters
outThe output stream to write to.
blockThe BlockType instance to output.
Returns
A reference to the output stream after the block information has been inserted.

Member Data Documentation

◆ id

uint8_t mcpp::BlockType::id

◆ mod

uint8_t mcpp::BlockType::mod

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