瀏覽代碼

improve system to save and load entities

Kolja Strohm 1 月之前
父節點
當前提交
ea9abd92dc

+ 3 - 10
FactoryCraft/BiomGenerator.cpp

@@ -111,7 +111,8 @@ void BiomGenerator::generatePlants(int x,
     }
 }
 
-void BiomGenerator::generateEntities(int x, int y, int z, int dimensionId)
+void BiomGenerator::generateEntities(
+    int x, int y, int z, int dimensionId, Chunk* zChunk)
 {
     for (EntityGenerator* entityGen : entityGenerators)
     {
@@ -120,15 +121,7 @@ void BiomGenerator::generateEntities(int x, int y, int z, int dimensionId)
             Entity* entity = entityGen->generate(
                 Framework::Vec3<float>((float)x, (float)y, (float)z),
                 dimensionId);
-            Dimension* dimension = Game::INSTANCE->zDimension(dimensionId);
-            if (dimension)
-            {
-                dimension->addEntity(entity);
-            }
-            else
-            {
-                entity->release();
-            }
+            zChunk->addGeneratedEntity(entity);
         }
     }
 }

+ 1 - 1
FactoryCraft/BiomGenerator.h

@@ -49,7 +49,7 @@ public:
         bool underground,
         bool underwater,
         int seaFluidBlockTypeId);
-    void generateEntities(int x, int y, int z, int dimensionId);
+    void generateEntities(int x, int y, int z, int dimensionId, Chunk* zChunk);
 
     const Framework::RCArray<StructureTemplateCollection>& getTemplates() const;
     Framework::Vec3<int> getMinStructureOffset() const;

+ 76 - 1
FactoryCraft/Chunk.cpp

@@ -7,6 +7,7 @@
 #include "Constants.h"
 #include "Dimension.h"
 #include "Entity.h"
+#include "EntityType.h"
 #include "FluidBlock.h"
 #include "Game.h"
 #include "NoBlock.h"
@@ -1053,10 +1054,37 @@ void Chunk::load(Framework::StreamReader* zReader)
         }
     }
     initializeLightning();
+    unsigned short entityCount;
+    zReader->lese((char*)&entityCount, 2);
+    lastSavedEntityIds.leeren();
+    entitiesInChunk.leeren();
+    for (int i = 0; i < entityCount; i++)
+    {
+        int type;
+        zReader->lese((char*)&type, 4);
+        Entity* entity = Game::INSTANCE->zEntityType(type)->loadEntity(zReader);
+        entitiesInChunk.add(entity);
+        lastSavedEntityIds.add(entity->getId());
+    }
 }
 
-void Chunk::save(Framework::StreamWriter* zWriter)
+void Chunk::save(Framework::StreamWriter* zWriter,
+    Framework::Array<Framework::Punkt>& otherChunksToSave)
 {
+    for (int id : lastSavedEntityIds)
+    {
+        if (!entitiesInChunk.anyMatch(
+                [id](const Entity* e) { return e->getId() == id; }))
+        {
+            Entity* old = Game::INSTANCE->zEntity(id);
+            if (old && old->getDimensionId() == getDimensionId()
+                && !old->isRemoved())
+            {
+                otherChunksToSave.add(Game::getChunkCenter(
+                    (int)old->getPosition().x, (int)old->getPosition().y));
+            }
+        }
+    }
     for (int index = 0; index < CHUNK_SIZE * CHUNK_SIZE; index++)
     {
         for (int z = 0; z < WORLD_HEIGHT; z++)
@@ -1080,6 +1108,29 @@ void Chunk::save(Framework::StreamWriter* zWriter)
             }
         }
     }
+    unsigned short len = (unsigned short)entitiesInChunk.getEintragAnzahl();
+    zWriter->schreibe((char*)&len, 2);
+    for (Entity* entity : entitiesInChunk)
+    {
+        if (!entity->isRemoved())
+        {
+            int type = entity->zType()->getId();
+            zWriter->schreibe((char*)&type, 4);
+            entity->zType()->saveEntity(entity, zWriter);
+        }
+        if (lastSavedEntityIds.getWertIndex(entity->getId()) < 0)
+        {
+            entity->getLastSavedChunkCenter().ifPresent(
+                [&otherChunksToSave](
+                    Framework::Punkt p) { otherChunksToSave.add(p); });
+        }
+        entity->setLastSavedChunkCenter(getCenter());
+    }
+    lastSavedEntityIds.leeren();
+    for (Entity* entity : entitiesInChunk)
+    {
+        lastSavedEntityIds.add(entity->getId());
+    }
 }
 
 void Chunk::removeUnusedBlocks()
@@ -1159,6 +1210,10 @@ void Chunk::prepareRemove()
             zNeighbours[i] = 0;
         }
     }
+    for (Entity* entity : entitiesInChunk)
+    {
+        entity->setRemoved();
+    }
     cs.unlock();
 }
 
@@ -1239,6 +1294,10 @@ int Chunk::getBlockTypeAtWC(int x, int y, int z) const
 
 void Chunk::onEntityEnters(Entity* zEntity, Chunk* lastChunk)
 {
+    if (zEntity->zType()->getId() != EntityTypeEnum::PLAYER)
+    {
+        this->entitiesInChunk.add(dynamic_cast<Entity*>(zEntity->getThis()));
+    }
     NetworkMessage* msg = 0;
     for (InformationObserver* observer : observers)
     {
@@ -1259,6 +1318,10 @@ void Chunk::onEntityEnters(Entity* zEntity, Chunk* lastChunk)
 
 void Chunk::onEntityLeaves(Entity* zEntity, Chunk* zNextChunk)
 {
+    if (zEntity->zType()->getId() != EntityTypeEnum::PLAYER)
+    {
+        this->entitiesInChunk.remove(this->entitiesInChunk.indexOf(zEntity));
+    }
     NetworkMessage* msg = 0;
     for (InformationObserver* observer : observers)
     {
@@ -1285,3 +1348,15 @@ bool Chunk::hasObserver(int entityId) const
     }
     return 0;
 }
+
+void Chunk::addGeneratedEntity(Entity* entity)
+{
+    entitiesInChunk.add(entity);
+    lastSavedEntityIds.add(entity->getId());
+    entity->setLastSavedChunkCenter(getCenter());
+}
+
+const Framework::RCArray<Entity>& Chunk::getEntitiesInChunk() const
+{
+    return entitiesInChunk;
+}

+ 7 - 1
FactoryCraft/Chunk.h

@@ -9,6 +9,7 @@
 #include "Block.h"
 #include "Constants.h"
 #include "DoLaterHandler.h"
+#include "Entity.h"
 #include "InformationObserver.h"
 #include "Tickable.h"
 
@@ -34,6 +35,8 @@ private:
     bool worldUpdated;
     unsigned char* lightData;
     bool currentlyLoading;
+    Framework::RCArray<Entity> entitiesInChunk;
+    Framework::Array<int> lastSavedEntityIds;
 
     void addLightSource(int z, int index);
     void removeLightSource(int z, int index);
@@ -76,7 +79,8 @@ public:
     void setNeighbor(Direction dir, Chunk* zChunk);
     Chunk* zNeighbor(Direction dir) const;
     void load(Framework::StreamReader* zReader);
-    void save(Framework::StreamWriter* zWriter);
+    void save(Framework::StreamWriter* zWriter,
+        Framework::Array<Framework::Punkt>& otherChunksToSave);
     void removeUnusedBlocks();
     int getDimensionId() const;
     void onLoaded();
@@ -95,6 +99,8 @@ public:
     void onEntityEnters(Entity* zEntity, Chunk* lastChunk);
     void onEntityLeaves(Entity* zEntity, Chunk* zNextChunk);
     bool hasObserver(int entityId) const;
+    void addGeneratedEntity(Entity* entity);
+    const Framework::RCArray<Entity>& getEntitiesInChunk() const;
 
     inline static int index(int x, int y)
     {

+ 64 - 27
FactoryCraft/Dimension.cpp

@@ -126,6 +126,7 @@ void Dimension::tickEntities()
         this->currentDayTime
             -= dayDuration + nightDuration + nightTransitionDuration * 2;
     }
+    entityCs.lock();
     for (auto entity : *entities)
     {
         if (!entity->isRemoved()
@@ -144,6 +145,7 @@ void Dimension::tickEntities()
             entity->tick(this);
         index++;
     }
+    entityCs.unlock();
 }
 
 void Dimension::thread()
@@ -171,6 +173,7 @@ void Dimension::thread()
             {
                 Chunk* removedChunk = removedChunks.z(0);
                 removedChunksCs.unlock();
+                Array<Framework::Punkt> chunksToSave;
                 Text filePath = Game::INSTANCE->getWorldDirectory() + "/dim/"
                               + getDimensionId() + "/";
                 filePath.appendHex(removedChunk->getCenter().x);
@@ -181,13 +184,34 @@ void Dimension::thread()
                 d.setDatei(filePath);
                 d.erstellen();
                 d.open(Datei::Style::schreiben);
-                removedChunk->save(&d);
+                removedChunk->save(&d, chunksToSave);
                 char addr[8];
                 getAddrOfWorld(removedChunk->getCenter(), addr);
                 map->removeMap(addr, 8);
                 d.close();
                 removedChunksCs.lock();
                 removedChunks.remove(0);
+                while (chunksToSave.getEintragAnzahl() > 0)
+                {
+                    Punkt cPos = chunksToSave.get(0);
+                    chunksToSave.remove(0);
+                    Chunk* c = zChunk(cPos);
+                    if (c)
+                    {
+                        Text filePath = Game::INSTANCE->getWorldDirectory()
+                                      + "/dim/" + getDimensionId() + "/";
+                        filePath.appendHex(cPos.x);
+                        filePath += "_";
+                        filePath.appendHex(cPos.y);
+                        filePath += ".chunk";
+                        Datei d;
+                        d.setDatei(filePath);
+                        d.erstellen();
+                        d.open(Datei::Style::schreiben);
+                        c->save(&d, chunksToSave);
+                        d.close();
+                    }
+                }
             }
             removedChunksCs.unlock();
             if (priorizedLightUpdateQueue.getEintragAnzahl())
@@ -411,7 +435,9 @@ void Dimension::sendBlockInfo(Framework::Vec3<int> location)
 
 void Dimension::addEntity(Entity* entity)
 {
+    entityCs.lock();
     entities->add(entity);
+    entityCs.unlock();
 }
 
 void Dimension::setChunk(Chunk* chunk, Punkt center)
@@ -433,6 +459,10 @@ void Dimension::setChunk(Chunk* chunk, Punkt center)
                 break;
             }
         }
+        for (Entity* entity : old->getEntitiesInChunk())
+        {
+            removeEntity(entity->getId());
+        }
     }
     chunks->set(addr, 8, chunk);
     if (chunk)
@@ -488,6 +518,10 @@ void Dimension::setChunk(Chunk* chunk, Punkt center)
     {
         Game::INSTANCE->zGenerator()->postprocessChunk(chunk);
         chunk->setAdded();
+        for (Entity* entity : chunk->getEntitiesInChunk())
+        {
+            addEntity(dynamic_cast<Entity*>(entity->getThis()));
+        }
         cs.lock();
         int index = 0;
         for (ArrayIterator<RequestQueue> iterator = waitingRequests.begin();
@@ -543,6 +577,7 @@ void Dimension::save(Text worldDir) const
     d.schreibe((char*)&nextStructureId, 8);
     d.schreibe((char*)&currentDayTime, 8);
     d.close();
+    Array<Framework::Punkt> otherChunks;
     for (auto chunk = chunkList.begin(); chunk; chunk++)
     {
         if (!chunk._) continue;
@@ -553,42 +588,33 @@ void Dimension::save(Text worldDir) const
         filePath.appendHex(chunk->getCenter().y);
         filePath += ".chunk";
         file->setDatei(filePath);
-        if (file->open(Datei::Style::schreiben)) chunk->save(file);
+        if (file->open(Datei::Style::schreiben)) chunk->save(file, otherChunks);
         file->close();
         file->release();
         char addr[8];
         getAddrOfWorld(chunk->getCenter(), addr);
         map->saveMap(addr, 8);
     }
-    Text filePath = worldDir + "/dim/" + dimensionId + "/entities";
-    Datei* file = new Datei();
-    file->setDatei(filePath);
-    if (file->open(Datei::Style::schreiben))
+    // since all chunks were saved otherChunks can be ignored
+    entityCs.lock();
+    for (Entity* entity : *entities)
     {
-        for (Entity* entity : *entities)
+        if (entity->zType()->getId() == EntityTypeEnum::PLAYER)
         {
-            if (entity->zType()->getId() != EntityTypeEnum::PLAYER)
+            Datei pFile;
+            pFile.setDatei(
+                worldDir + "/player/"
+                + Game::INSTANCE->getPlayerId(((Player*)entity)->getName()));
+            pFile.erstellen();
+            if (pFile.open(Datei::Style::schreiben))
             {
-                if (!entity->isRemoved())
-                {
-                    int type = entity->zType()->getId();
-                    file->schreibe((char*)&type, 4);
-                    Game::INSTANCE->zEntityType(type)->saveEntity(entity, file);
-                }
-            }
-            else
-            {
-                Datei pFile;
-                pFile.setDatei(worldDir + "/player/"
-                               + Game::INSTANCE->getPlayerId(
-                                   ((Player*)entity)->getName()));
-                if (pFile.open(Datei::Style::schreiben))
-                    Game::INSTANCE->zEntityType(EntityTypeEnum::PLAYER)
-                        ->saveEntity(entity, &pFile);
+                Game::INSTANCE->zEntityType(EntityTypeEnum::PLAYER)
+                    ->saveEntity(entity, &pFile);
+                pFile.close();
             }
         }
-        file->close();
     }
+    entityCs.unlock();
     for (MultiblockStructure* structure : structures)
     {
         saveStructure(structure);
@@ -678,12 +704,18 @@ void Dimension::removeOldChunks()
     structurCs.unlock();
 }
 
-Entity* Dimension::zEntity(int id)
+Entity* Dimension::zEntity(int id) const
 {
+    entityCs.lock();
     for (auto entity : *entities)
     {
-        if (!entity->isRemoved() && entity->getId() == id) return entity;
+        if (!entity->isRemoved() && entity->getId() == id)
+        {
+            entityCs.unlock();
+            return entity;
+        }
     }
+    entityCs.unlock();
     return 0;
 }
 
@@ -692,6 +724,7 @@ Entity* Dimension::zNearestEntity(
 {
     Entity* result = 0;
     float sqDist = 0;
+    entityCs.lock();
     for (auto entity : *entities)
     {
         if (!entity->isRemoved() && filter(entity))
@@ -704,21 +737,25 @@ Entity* Dimension::zNearestEntity(
             }
         }
     }
+    entityCs.unlock();
     return result;
 }
 
 void Dimension::removeEntity(int id)
 {
     int index = 0;
+    entityCs.lock();
     for (auto entity : *entities)
     {
         if (entity->getId() == id)
         {
             entities->remove(index);
+            entityCs.unlock();
             return;
         }
         index++;
     }
+    entityCs.unlock();
 }
 
 void Dimension::removeSubscriptions(Entity* zEntity)

+ 2 - 1
FactoryCraft/Dimension.h

@@ -39,6 +39,7 @@ private:
     Framework::Array<Chunk*> chunkList;
     Framework::Critical chunkCs;
     Framework::RCArray<Entity>* entities;
+    mutable Framework::Critical entityCs;
     Framework::Array<RequestQueue> waitingRequests;
     Framework::Critical cs;
     Framework::Array<Framework::Vec3<int>> lightUpdateQueue;
@@ -92,7 +93,7 @@ public:
     Chunk* zChunk(Framework::Punkt wPos) const;
     float getGravity() const;
     void removeOldChunks();
-    Entity* zEntity(int id);
+    Entity* zEntity(int id) const;
     Entity* zNearestEntity(
         Framework::Vec3<float> pos, std::function<bool(Entity*)> filter);
     void removeEntity(int id);

+ 31 - 35
FactoryCraft/DimensionGenerator.cpp

@@ -283,6 +283,7 @@ Chunk* BiomedCavedDimensionGenerator::generateChunk(int centerX, int centerY)
     double blockGenTime = 0;
     Framework::ZeitMesser zm;
     Framework::ZeitMesser zmGlobal;
+    Framework::ZeitMesser entityGenTime;
     zm.messungStart();
     zmGlobal.messungStart();
 #endif
@@ -499,6 +500,36 @@ Chunk* BiomedCavedDimensionGenerator::generateChunk(int centerX, int centerY)
     caveGen->release();
     structures->release();
 #ifdef CHUNK_GENERATION_DEBUG_LOG
+    entityGenTime.messungStart();
+#endif
+    *xPos = (float)chunk->getCenter().x;
+    *yPos = (float)chunk->getCenter().y;
+    calculateHeightLayers();
+    BiomGenerator* biom = zBiomGenerator();
+    for (int x = -CHUNK_SIZE / 2; x < CHUNK_SIZE / 2; x++)
+    {
+        for (int y = -CHUNK_SIZE / 2; y < CHUNK_SIZE / 2; y++)
+        {
+            for (int z = 0; z < WORLD_HEIGHT; z++)
+            {
+                if (chunk->getBlockTypeAt(Framework::Vec3<int>(
+                        x + CHUNK_SIZE / 2, y + CHUNK_SIZE / 2, z))
+                    == BlockTypeEnum::AIR)
+                {
+                    *xPos = (float)x + (float)chunk->getCenter().x;
+                    *yPos = (float)y + (float)chunk->getCenter().y;
+                    *zPos = (float)z;
+                    biom->generateEntities(x + chunk->getCenter().x,
+                        y + chunk->getCenter().y,
+                        z,
+                        getDimensionId(),
+                        chunk);
+                }
+            }
+        }
+    }
+#ifdef CHUNK_GENERATION_DEBUG_LOG
+    entityGenTime.messungEnde();
     zmGlobal.messungEnde();
     Framework::Logging::trace() << "structureGenerationTime: " << structureTime;
     Framework::Logging::trace() << "caveGenerationTime: " << caveTime;
@@ -634,41 +665,6 @@ void BiomedCavedDimensionGenerator::postprocessChunk(Chunk* zChunk)
     zMemory()->unlock();
 }
 
-void BiomedCavedDimensionGenerator::generateEntities(Chunk* zChunk)
-{
-    zMemory()->lock();
-    zMemory()->setCurrentChunk(dynamic_cast<Chunk*>(zChunk->getThis()));
-
-    *xPos = (float)zChunk->getCenter().x;
-    *yPos = (float)zChunk->getCenter().y;
-
-    calculateHeightLayers();
-    BiomGenerator* biom = zBiomGenerator();
-    for (int x = -CHUNK_SIZE / 2; x < CHUNK_SIZE / 2; x++)
-    {
-        for (int y = -CHUNK_SIZE / 2; y < CHUNK_SIZE / 2; y++)
-        {
-            for (int z = 0; z < WORLD_HEIGHT; z++)
-            {
-                if (zChunk->getBlockTypeAt(Framework::Vec3<int>(
-                        x + CHUNK_SIZE / 2, y + CHUNK_SIZE / 2, z))
-                    == BlockTypeEnum::AIR)
-                {
-                    *xPos = (float)x + (float)zChunk->getCenter().x;
-                    *yPos = (float)y + (float)zChunk->getCenter().y;
-                    *zPos = (float)z;
-                    biom->generateEntities(x + zChunk->getCenter().x,
-                        y + zChunk->getCenter().y,
-                        z,
-                        getDimensionId());
-                }
-            }
-        }
-    }
-
-    zMemory()->unlock();
-}
-
 Framework::Either<Block*, int> BiomedCavedDimensionGenerator::generateBlock(
     Framework::Vec3<int> location)
 {

+ 0 - 2
FactoryCraft/DimensionGenerator.h

@@ -81,7 +81,6 @@ public:
     virtual bool spawnStructure(Framework::Vec3<int> location,
         std::function<bool(GeneratorTemplate* tmpl)> filter)
         = 0;
-    virtual void generateEntities(Chunk* zChunk) = 0;
     int getDimensionId() const;
     void addHeightLayer(WorldHeightLayer* layer);
     const Framework::RCArray<WorldHeightLayer>& getHeightLayers() const;
@@ -196,7 +195,6 @@ public:
 
     Chunk* generateChunk(int centerX, int centerY) override;
     void postprocessChunk(Chunk* zChunk) override;
-    void generateEntities(Chunk* zChunk) override;
     Framework::Either<Block*, int> generateBlock(
         Framework::Vec3<int> location) override;
     bool spawnStructure(Framework::Vec3<int> location,

+ 18 - 1
FactoryCraft/Entity.cpp

@@ -223,6 +223,7 @@ Entity::Entity(
     : Inventory(location, dimensionId, true),
       chatSecurityLevel(0),
       lastChunkCenter(0, 0),
+      lastSavedChunkCenter(Framework::Maybe<Framework::Punkt>::empty()),
       lastDimensionId(-1),
       speed(0, 0, 0),
       faceDir(1, 0, 0),
@@ -571,6 +572,7 @@ void Entity::prepareTick(const Dimension* zDimension) {}
 
 void Entity::tick(const Dimension* zDimension)
 {
+    if (removed) return;
     if (placeBlockCooldown > 0)
     {
         placeBlockCooldown--;
@@ -904,4 +906,19 @@ bool Entity::isMoving() const
 int Entity::getChatSecurityLevel() const
 {
     return chatSecurityLevel;
-}
+}
+
+Framework::Maybe<Framework::Punkt> Entity::getLastSavedChunkCenter() const
+{
+    return lastSavedChunkCenter;
+}
+
+void Entity::setLastSavedChunkCenter(Framework::Punkt pos)
+{
+    lastSavedChunkCenter = Framework::Maybe<Framework::Punkt>::of(pos);
+}
+
+void Entity::setRemoved()
+{
+    removed = true;
+}

+ 5 - 0
FactoryCraft/Entity.h

@@ -1,5 +1,6 @@
 #pragma once
 
+#include <Maybe.h>
 #include <ReferenceCounter.h>
 #include <Vec2.h>
 #include <Vec3.h>
@@ -61,6 +62,7 @@ private:
     int chatSecurityLevel;
     Framework::Punkt lastChunkCenter;
     int lastDimensionId;
+    Framework::Maybe<Framework::Punkt> lastSavedChunkCenter;
 
 protected:
     float maxHP;
@@ -141,6 +143,9 @@ public:
     float getMaxSpeed() const;
     bool isMoving() const;
     int getChatSecurityLevel() const;
+    Framework::Maybe<Framework::Punkt> getLastSavedChunkCenter() const;
+    void setLastSavedChunkCenter(Framework::Punkt pos);
+    void setRemoved();
 
     friend Effect;
     friend EntityType;

+ 4 - 2
FactoryCraft/Game.cpp

@@ -449,13 +449,13 @@ void Game::thread()
                                + getPlayerId(player->zEntity()->getName()));
                 pFile.erstellen();
                 if (pFile.open(Datei::Style::schreiben))
+                {
                     zEntityType(EntityTypeEnum::PLAYER)
                         ->saveEntity(player->zEntity(), &pFile);
+                }
                 pFile.close();
-                removed.add(index, 0);
                 Dimension* dim
                     = zDimension(player->zEntity()->getDimensionId());
-                dim->removeSubscriptions(player->zEntity());
                 Chunk* chunk = dim->zChunk(
                     getChunkCenter((int)player->zEntity()->getLocation().x,
                         (int)player->zEntity()->getLocation().y));
@@ -464,6 +464,8 @@ void Game::thread()
                     chunk->onEntityLeaves(player->zEntity(), 0);
                 }
                 dim->removeEntity(player->zEntity()->getId());
+                removed.add(index, 0);
+                dim->removeSubscriptions(player->zEntity());
             }
             else
             {

+ 1 - 2
FactoryCraft/GameClient.cpp

@@ -15,7 +15,6 @@ GameClient::GameClient(Player* zPlayer, FCKlient* client)
       viewDistance(DEFAULT_VIEW_DISTANCE),
       first(1),
       online(1),
-      finished(0),
       backgroundFinished(0),
       foregroundFinished(0)
 {
@@ -29,7 +28,7 @@ GameClient::~GameClient()
     emptyBackgroundQueueSync.notifyAll();
     foregroundQueueSync.notify();
     backgroundQueueSync.notify();
-    while (!finished || !foregroundFinished || !backgroundFinished)
+    while (!foregroundFinished || !backgroundFinished)
         Sleep(100);
     client->release();
 }

+ 0 - 1
FactoryCraft/GameClient.h

@@ -28,7 +28,6 @@ private:
     int viewDistance;
     bool first;
     bool online;
-    bool finished;
     bool backgroundFinished;
     bool foregroundFinished;
 

+ 0 - 2
FactoryCraft/WorldGenerator.cpp

@@ -163,8 +163,6 @@ void WorldGenerator::thread()
 #endif
                     generatedChunk->getThis();
                     dim->setChunk(generatedChunk, Punkt(x, y));
-                    zGenerator(next.dimensionId)
-                        ->generateEntities(generatedChunk);
                     generatedChunk->release();
                     zm.messungEnde();
 #ifdef CHUNK_GENERATION_DEBUG_LOG