World.h 478 B

123456789101112131415161718192021
  1. #ifndef WORLD_H
  2. #define WORLD_H
  3. #include "common/block/BlockRegistry.h"
  4. class World final {
  5. public:
  6. World(const BlockRegistry& blockRegistry);
  7. void setBlock(int x, int y, int z, const Block& block);
  8. const Block& getBlock(int x, int y, int z) const;
  9. static constexpr int WORLD_SIZE = 32;
  10. private:
  11. static constexpr int BITMASK = WORLD_SIZE - 1;
  12. const BlockRegistry& blockRegistry;
  13. BlockId blocks[WORLD_SIZE][WORLD_SIZE][WORLD_SIZE];
  14. };
  15. #endif