Esempio n. 1
0
 private void writeChangedBlock(UpdateBlock block)
 {
     WriteInt(block.Pos.x);
     WriteInt(block.Pos.y);
     WriteInt(block.Pos.z);
     WriteByte((byte)block.type);
     WriteByte(block.exid);
 }
Esempio n. 2
0
        private void SingleGeneratorWorker()
        {
            //单机使用
            Chunk chunk = DeGeneratorQueue();

            if (chunk != null)
            {
                WorldPos pos = chunk.worldPos;
                if (World.world.GetChunk(pos.x, pos.y, pos.z) == null)
                {
                    return;
                }
                if (!chunk.isTerrainDataPrepared)
                {
                    _terrainControlGenerator.Generate(chunk);
                    if (WorldConfig.Instance.CaveEnable)
                    {
                        _cavesGenerator.generate(chunk);
                    }
                    chunk.isTerrainDataPrepared = true;
                    chunk.isUpdate = true;
                }

                CheckAroundChunkAndGeneratorPopulation(chunk, false);
                RemoveSingleGenerateChunk(chunk);
            }

            RefreshChunkArea refreshChunkArea = DeRefreshQueue();

            if (refreshChunkArea != null)
            {
                for (int i = 0; i < refreshChunkArea.chunkList.Count; i++)
                {
                    if (refreshChunkArea.chunkList[i].refreshList.Count > 0)
                    {
                        for (int j = 0; j < refreshChunkArea.chunkList[i].refreshList.Count; j++)
                        {
                            UpdateBlock updateBlock = refreshChunkArea.chunkList[i].refreshList[j];
                            refreshChunkArea.chunkList[i].chunk.UpdateChangedBlock(updateBlock);
                        }
                    }
                }
                ReculateChunkAreaLightAndAround(refreshChunkArea, true);
            }
        }
Esempio n. 3
0
        //更新网络大范围更新数据
        private void refreshNetArea()
        {
            RefreshChunkArea netRefreshChunkArea = DeNetRefreshAreaQueue();

            if (netRefreshChunkArea != null)
            {
                for (int i = 0; i < netRefreshChunkArea.chunkList.Count; i++)
                {
                    if (netRefreshChunkArea.chunkList[i].refreshList.Count > 0)
                    {
                        for (int j = 0; j < netRefreshChunkArea.chunkList[i].refreshList.Count; j++)
                        {
                            UpdateBlock updateBlock = netRefreshChunkArea.chunkList[i].refreshList[j];
                            netRefreshChunkArea.chunkList[i].chunk.UpdateChangedBlock(updateBlock);
                        }
                    }
                }
                ReculateChunkAreaLightAndAround(netRefreshChunkArea, true);
            }
        }
Esempio n. 4
0
        public void UpdateChangedBlock(UpdateBlock updateBlock)
        {
            Block b = new Block(updateBlock.type, updateBlock.exid);

            this.SetBlock(updateBlock.Pos.x - this.worldPos.x, updateBlock.Pos.y, updateBlock.Pos.z - this.worldPos.z, b);
        }