1234567891011121314151617181920212223 |
- #ifndef BLOCKREGISTRY_H
- #define BLOCKREGISTRY_H
- #include "common/block/Block.h"
- #include "common/block/BlockTypes.h"
- #include "gaming-core/utils/HashMap.h"
- #include "gaming-core/utils/List.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);
- List<Block> blocks;
- HashMap<BlockName, BlockId> registryToId;
- };
- #endif
|