public void ChangedBlock(WorldPos pos, ClientChangedBlock block) { lock (_chunkMap) { ClientChangedChunk changedChunk; _chunkMap.TryGetValue(pos, out changedChunk); if (changedChunk == null) { // changedChunk = new ClientChangedChunk(); // _chunkMap.Add(pos,changedChunk); throw new Exception("位置为Pos:" + pos.ToString() + "的chunk不存在,不能更改block:" + block.index); } changedChunk.ChangeBlock(block); } }
public void ChangedSign(WorldPos pos, int sign) { lock (_chunkMap) { ClientChangedChunk changedChunk; _chunkMap.TryGetValue(pos, out changedChunk); if (changedChunk == null) { // changedChunk = new ClientChangedChunk(); // _chunkMap.Add(pos,changedChunk); //正常情况下不会出现为空的情况 throw new Exception("位置为Pos:" + pos.ToString() + "的chunk不存在,不能更改sign:" + sign); } changedChunk.ChangeSign(sign); } }