World.h 668 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef WORLD_H
  2. #define WORLD_H
  3. #include "common/block/BlockRegistry.h"
  4. #include "common/entities/Player.h"
  5. #include "common/world/BlockStorage.h"
  6. #include "utils/List.h"
  7. class World final {
  8. const BlockRegistry& blockRegistry;
  9. BlockStorage blocks;
  10. List<Player*> players;
  11. public:
  12. mutable bool dirty;
  13. World(const BlockRegistry& blockRegistry);
  14. void setBlock(int x, int y, int z, const Block& block);
  15. const Block& getBlock(int x, int y, int z) const;
  16. int getSize() const;
  17. int getHeight() const;
  18. void addPlayer(Player* p);
  19. void tick();
  20. private:
  21. List<CollisionBox> getBoxes(const CollisionBox& box) const;
  22. };
  23. #endif