World.h 764 B

123456789101112131415161718192021222324252627282930313233343536
  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. Vector3 limitMove(const Entity& e, Vector3 move) const;
  22. private:
  23. List<CollisionBox> getBoxes(const CollisionBox& box) const;
  24. };
  25. #endif