Exemple #1
0
 public void Collection(WorldPos pos, int x, int y, int z, Block block)
 {
     if (canCollection)
     {
         List <ClientChangedBlock> list;
         _map.TryGetValue(pos, out list);
         if (list == null)
         {
             list = new List <ClientChangedBlock>();
             _map.Add(pos, list);
         }
         Int16 index     = ClientChangedChunk.GetChunkIndex(x, y, z);
         byte  blockType = (byte)block.BlockType;
         byte  extendId  = block.ExtendId;
         ClientChangedBlock changedBlock = new ClientChangedBlock(index, blockType, extendId);
         list.Add(changedBlock);
     }
 }
Exemple #2
0
 public void ChangedArea(RefreshChunkArea area)
 {
     lock (_chunkMap)
     {
         for (int i = 0; i < area.chunkList.Count; i++)
         {
             ClientChangedChunk changedChunk;
             _chunkMap.TryGetValue(area.chunkList[i].chunk.worldPos, out changedChunk);
             if (changedChunk != null)
             {
                 for (int j = 0; j < area.chunkList[i].refreshList.Count; j++)
                 {
                     Int16 index = ClientChangedChunk.GetChunkIndex(area.chunkList[i].refreshList[j].Pos.x, area.chunkList[i].refreshList[j].Pos.y, area.chunkList[i].refreshList[j].Pos.z);
                     ClientChangedBlock block = new ClientChangedBlock(index, (byte)area.chunkList[i].refreshList[j].type, area.chunkList[i].refreshList[j].exid);
                     changedChunk.ChangeBlock(block);
                 }
             }
         }
     }
 }