diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-08-18 17:13:01 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-08-18 17:13:01 +0200 |
commit | a2fe2786682e626dae25db2d375280c83b615796 (patch) | |
tree | 34bc8295ad75b967519959e6300aada5531e2345 /src/World.hpp | |
parent | 2017-08-17 (diff) | |
download | AltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar AltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar.gz AltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar.bz2 AltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar.lz AltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar.xz AltCraft-a2fe2786682e626dae25db2d375280c83b615796.tar.zst AltCraft-a2fe2786682e626dae25db2d375280c83b615796.zip |
Diffstat (limited to 'src/World.hpp')
-rw-r--r-- | src/World.hpp | 32 |
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 |