瀏覽代碼

fix light receiving

Kolja Strohm 2 年之前
父節點
當前提交
ed4ef8b1db
共有 2 個文件被更改,包括 7 次插入2 次删除
  1. 6 0
      FactoryCraft/Chunk.cpp
  2. 1 2
      FactoryCraft/Dimension.cpp

+ 6 - 0
FactoryCraft/Chunk.cpp

@@ -88,6 +88,12 @@ void Chunk::setBlock(Block* block)
             iterator->release();
             iterator.set(block);
             cs.unlock();
+            vcs.lock();
+            if (block->isVisible())
+            {
+                visibleBlocks.add(block);
+            }
+            vcs.unlock();
             return;
         }
     }

+ 1 - 2
FactoryCraft/Dimension.cpp

@@ -101,7 +101,6 @@ void Dimension::api(char* message)
             int x = *(int*)(message + 1);
             int y = *(int*)(message + 5);
             int z = *(int*)(message + 9);
-            int index = *(int*)(message + 1);
             Framework::Vec3<int> location(x, y, z);
             for (int i = 0; i < 6; i++)
             {
@@ -115,7 +114,7 @@ void Dimension::api(char* message)
                         bool visible = zB->isVisible();
                         zB->setLightData(
                             getOppositeDirection(getDirectionFromIndex(i)),
-                            (unsigned char*)(message + 5));
+                            (unsigned char*)(message + 13));
                         if (zB->isVisible() != visible)
                         {
                             zChunk(World::INSTANCE->getChunkCenter(pos.x, pos.y))