World.h 703 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef WORLD_H
  2. #define WORLD_H
  3. #include "common/block/BlockRegistry.h"
  4. #include "common/entities/Entity.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<Entity*> entities;
  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 addEntity(Entity* e);
  19. void removeEntity(Entity* e);
  20. void tick();
  21. private:
  22. List<CollisionBox> getBoxes(const CollisionBox& box) const;
  23. };
  24. #endif