12345678910111213141516171819202122232425 |
- #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);
- static constexpr int MAX_BLOCKS = 4096;
- List<Block, MAX_BLOCKS> blocks;
- HashMap<BlockName, BlockId, MAX_BLOCKS> registryToId;
- };
- #endif
|