#ifndef BLOCKREGISTRY_H #define BLOCKREGISTRY_H #include "common/block/BlockTypes.h" #include "gaming-core/utils/List.h" #include "gaming-core/utils/HashMap.h" #include "common/block/Block.h" class BlockRegistry final { public: BlockRegistry(); void forEach(void (*f) (const Block&)) const; const Block& getBlock(const BlockName& registry) const; const Block& getBlock(BlockId id) const; private: void add(const char* registry, const BlockBuilder& builder); static constexpr int MAX_BLOCKS = 4096; List blocks; HashMap registryToId; }; #endif