BlockRegistry.h 398 B

123456789101112131415161718192021222324
  1. #ifndef BLOCKREGISTRY_H
  2. #define BLOCKREGISTRY_H
  3. #include <unordered_map>
  4. #include "common/block/Block.h"
  5. class BlockRegistry
  6. {
  7. public:
  8. static Block NULL_BLOCK;
  9. BlockRegistry();
  10. const Block& getBlock(const std::string&) const;
  11. const Block& getBlock(BlockId id) const;
  12. private:
  13. std::unordered_map<std::string, Block> registry;
  14. BlockId idCounter;
  15. };
  16. #endif