World.h 644 B

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