Exemple #1
0
        /// <summary> Finds all block changes which affect the given coordinates. </summary>
        public void FindChangesAt(ushort x, ushort y, ushort z, Action <BlockDBEntry> output)
        {
            using (IDisposable readLock = locker.AccquireReadLock()) {
                if (!File.Exists(FilePath))
                {
                    return;
                }

                using (Stream s = File.OpenRead(FilePath)) {
                    Vec3U16 dims;
                    BlockDBFile.ReadHeader(s, out dims);
                    if (x >= dims.X || y >= dims.Y || z >= dims.Z)
                    {
                        return;
                    }

                    int index = (y * dims.Z + z) * dims.X + x;
                    BlockDBFile.FindChangesAt(s, index, output);
                }
            }
        }