mcpp
C++ Minecraft Library
mcpp::BlockType Class Reference

#include <block.h>

Public Member Functions

constexpr BlockType (int id=0, int modifier=0)
 
bool operator== (const BlockType &other) const
 Equality comparison operator. More...
 
bool operator!= (const BlockType &other) const
 Inequality comparison operator. More...
 
BlockType withMod (int modifier) const
 

Public Attributes

int id
 
int mod
 

Friends

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

Constructor & Destructor Documentation

◆ BlockType()

constexpr mcpp::BlockType::BlockType ( int  id = 0,
int  modifier = 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.

◆ withMod()

BlockType mcpp::BlockType::withMod ( int  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 Function 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

int mcpp::BlockType::id

◆ mod

int mcpp::BlockType::mod

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