Block
A single 16-bit packed voxel value: 12-bit type ID + 4-bit metadata.
Overview
Block (namespace GalaxyEggbert::Worlds) is a uint16_t-packed
voxel value. High 12 bits encode the block type ID (0..4095, matching an icon index into
object-m.png); low 4 bits encode metadata (0..15).
Header: include/GalaxyEggbert/Worlds/Block.hpp.
API
class Block {
public:
static Block air(); // raw value 0
static Block make(uint16_t type, uint8_t metadata = 0); // validates ranges
uint16_t type() const;
uint8_t metadata() const;
BlockMetadata blockMetadata() const; // wraps the 4-bit nibble
bool isAir() const;
uint16_t rawValue() const;
};
make() throws std::out_of_range if type > VoxelConfig::MaxBlockType
(4095) or metadata > VoxelConfig::MaxBlockMetadata (15).
Encoding
rawValue = (type << 4) | (metadata & 0xF)
type() == 0 means Air (no block).
Used By
Chunk stores a palette of unique Block values per 10³ sub-volume; World stores 1000 chunks.