1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #pragma once
- #include <Punkt.h>
- #include <Reader.h>
- #include "Chunk.h"
- #include "NetworkResponse.h"
- class Dimension : public virtual Framework::ReferenceCounter
- {
- private:
- int dimensionId;
- float gravity;
- Framework::Trie<Chunk>* chunks;
- Framework::Array<Chunk*> chunkList;
- Framework::RCArray<Entity>* entities;
- void getAddrOf(Framework::Punkt cPos, char* addr) const;
- void getAddrOfWorld(Framework::Punkt wPos, char* addr) const;
- public:
- Dimension(int id);
- ~Dimension();
- void api(Framework::StreamReader* zRequest, NetworkResponse* zResponse);
- void tickEntities();
- Framework::Either<Block*, int> zBlock(Framework::Vec3<int> location);
- Block* zRealBlockInstance(Framework::Vec3<int> location);
- void placeBlock(Framework::Vec3<int> location, Framework::Either<Block*, int> block);
- void addEntity(Entity* entity);
- void setChunk(Chunk* chunk, Framework::Punkt center);
- void save(Framework::Text worldDir) const;
- int getDimensionId() const;
- bool hasChunck(int x, int y) const;
- Chunk* zChunk(Framework::Punkt wPos) const;
- float getGravity() const;
- void removeOldChunks();
- Entity* zEntity(int id);
- Entity* zNearestEntity(Framework::Vec3<float> pos, std::function<bool(Entity*)> filter);
- void removeEntity(int id);
- };
|