1234567891011121314151617181920212223 |
- #ifndef BLOCKREGISTRY_H
- #define BLOCKREGISTRY_H
- #include <vector>
- #include <unordered_map>
- #include "common/utils/HashedString.h"
- #include "common/block/Block.h"
- class BlockRegistry final {
- 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<Block> blocks;
- std::unordered_map<HashedString, u16, HashedString::Hasher> registryToId;
- };
- #endif
|