World.h 482 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(uint x, uint y, uint z, const Block& block);
  8. const Block& getBlock(uint x, uint y, uint z) const;
  9. static constexpr uint WORLD_SIZE = 32;
  10. private:
  11. static constexpr uint BITMASK = WORLD_SIZE - 1;
  12. const BlockRegistry& blockRegistry;
  13. u16 blocks[WORLD_SIZE][WORLD_SIZE][WORLD_SIZE];
  14. };
  15. #endif