public ushort this[BlockPos p] { get { if (p.Y < -200) { return(1); } var chunk = PeekChunk((ChunkPos)p); if (chunk == null) { return(0); } return(chunk[p.X & _chunkMask, p.Y & _chunkMask, p.Z & _chunkMask]); } set { var chunkPos = (ChunkPos)p; var chunk = GetChunk(chunkPos); if (chunk.IsCreated) { chunk[p.X & _chunkMask, p.Y & _chunkMask, p.Z & _chunkMask] = value; Universe?.SaveFile?.Write(StorageKey.Get("ChunkData", chunkPos), StorageValue.Serialize(chunk.GetChunkData())); } } }
private void Save() { _saveFile?.Write(_storageKey, StorageValue.Serialize(GetChunkData())); }