#ifndef BLOCKREGISTRY_H #define BLOCKREGISTRY_H #include #include #include "common/utils/HashedString.h" #include "common/block/Block.h" class BlockRegistry { public: BlockRegistry(); const Block& getBlock(const HashedString& registry) const; const Block& getBlock(u16 id) const; private: void add(const char* registry, const BlockBuilder& builder); std::vector blocks; struct Hasher { size_t operator()(const HashedString& key) const; }; std::unordered_map registryToId; }; #endif