summaryrefslogtreecommitdiffstats
path: root/src/World.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/World.hpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/World.hpp b/src/World.hpp
index 06155cf..a90d437 100644
--- a/src/World.hpp
+++ b/src/World.hpp
@@ -15,20 +15,18 @@
#include "Vector.hpp"
class World {
- std::map<Vector, Section> sections;
- std::map<Vector, std::mutex> sectionMutexes;
- int dimension = 0;
+ int dimension = 0;
+ std::map<Vector, PackedSection> sections;
+ std::map<Vector, Section> cachedSections;
- Section ParseSection(StreamInput *data, Vector position);
+ PackedSection ParseSection(StreamInput *data, Vector position);
- void ParserFunc();
+ std::vector<Entity> entities;
+
+ std::mutex entitiesMutex;
- std::queue<Section> toParse;
- std::mutex parseMutex;
+ Block& GetBlock(Vector worldPosition);
- bool isRunning = true;
- std::thread parser;
-
public:
World();
@@ -36,17 +34,17 @@ public:
void ParseChunkData(std::shared_ptr<PacketChunkData> packet);
- bool isPlayerCollides(double X, double Y, double Z);
+ void ParseChunkData(std::shared_ptr<PacketBlockChange> packet);
- Block &GetBlock(Vector pos);
+ void ParseChunkData(std::shared_ptr<PacketMultiBlockChange> packet);
- std::vector<Vector> GetSectionsList();
+ bool isPlayerCollides(double X, double Y, double Z);
- Section &GetSection(Vector sectionPos);
+ std::vector<Vector> GetSectionsList();
- glm::vec3 Raycast(glm::vec3 position, glm::vec3 direction, float maxLength = 1000.0f, float minPrecision = 0.01f);
+ const Section &GetSection(Vector sectionPos);
- std::vector<Entity> entities;
+ glm::vec3 Raycast(glm::vec3 position, glm::vec3 direction, float maxLength = 1000.0f, float minPrecision = 0.01f);
void UpdatePhysics(float delta);
@@ -55,4 +53,6 @@ public:
std::vector<unsigned int> GetEntitiesList();
void AddEntity(Entity entity);
+
+ void DeleteEntity(unsigned int EntityId);
}; \ No newline at end of file