World.h 614 B

12345678910111213141516171819202122232425262728293031
  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 preTick();
  20. void tick();
  21. };
  22. #endif