Blocks.h 532 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef BLOCKS_H
  2. #define BLOCKS_H
  3. #include "Block.h"
  4. #include "BlockAir.h"
  5. class BlockRegistry
  6. {
  7. public:
  8. static const Block& getBlockFromId(BlockId id);
  9. static void registerBlocks();
  10. private:
  11. BlockRegistry();
  12. static void init();
  13. static void registerBlock(const Block& block);
  14. static const int BLOCK_AMOUNT;
  15. static const Block* BLOCKS[];
  16. };
  17. namespace Blocks
  18. {
  19. extern const BlockAir AIR;
  20. extern const Block GRASS;
  21. extern const Block DIRT;
  22. extern const Block STONE;
  23. };
  24. #endif