private unsafe HuedTile[][][] ReadStaticBlock(int x, int y)
        {
            if (_indexReader == null)
            {
                return(_emptyStaticBlock);
            }

            _indexReader.BaseStream.Seek(((x * _blockHeight) + y) * 12, SeekOrigin.Begin);

            int lookup = _indexReader.ReadInt32();
            int length = _indexReader.ReadInt32();

            if (lookup < 0 || length <= 0)
            {
                return(_emptyStaticBlock);
            }

            int count = length / 7;

            _staticsStream.Seek(lookup, SeekOrigin.Begin);

            StaticTile[] staTiles = new StaticTile[count];

            fixed(StaticTile *pTiles = staTiles)
            {
                byte[] buffer = new byte[length];
                _staticsStream.Read(buffer, 0, buffer.Length);

                using (MemoryStream stream = new MemoryStream(buffer))
                    using (BinaryReader reader = new BinaryReader(stream))
                    {
                        StaticTile *ptr = pTiles;
                        for (int i = 0; i < 64; i++)
                        {
                            ptr->ID  = reader.ReadInt16();
                            ptr->X   = reader.ReadByte();
                            ptr->Y   = reader.ReadByte();
                            ptr->Z   = reader.ReadSByte();
                            ptr->Hue = reader.ReadInt16();
                        }
                    }

                if (_lists == null)
                {
                    _lists = new HuedTileList[8][];

                    for (int i = 0; i < 8; ++i)
                    {
                        _lists[i] = new HuedTileList[8];

                        for (int j = 0; j < 8; ++j)
                        {
                            _lists[i][j] = new HuedTileList();
                        }
                    }
                }

                HuedTileList[][] lists = _lists;

                StaticTile *pCur = pTiles, pEnd = pTiles + count;

                while (pCur < pEnd)
                {
                    lists[pCur->X & 0x7][pCur->Y & 0x7].Add((short)((pCur->ID & 0x3FFF) + 0x4000), pCur->Hue, pCur->Z);
                    ++pCur;
                }

                HuedTile[][][] tiles = new HuedTile[8][][];

                for (int i = 0; i < 8; ++i)
                {
                    tiles[i] = new HuedTile[8][];

                    for (int j = 0; j < 8; ++j)
                    {
                        tiles[i][j] = lists[i][j].ToArray();
                    }
                }

                return(tiles);
            }
        }
        private unsafe HuedTile[][][] ReadStaticBlock(int x, int y)
        {
            if (_indexReader == null)
                return _emptyStaticBlock;

            _indexReader.BaseStream.Seek(((x * _blockHeight) + y) * 12, SeekOrigin.Begin);

            int lookup = _indexReader.ReadInt32();
            int length = _indexReader.ReadInt32();

            if (lookup < 0 || length <= 0)
            {
                return _emptyStaticBlock;
            }

            int count = length / 7;

            _staticsStream.Seek(lookup, SeekOrigin.Begin);

            StaticTile[] staTiles = new StaticTile[count];

            fixed (StaticTile* pTiles = staTiles)
            {
                byte[] buffer = new byte[length];
                _staticsStream.Read(buffer, 0, buffer.Length);

                using (MemoryStream stream = new MemoryStream(buffer))
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    StaticTile* ptr = pTiles;
                    for (int i = 0; i < 64; i++)
                    {
                        ptr->ID = reader.ReadInt16();
                        ptr->X = reader.ReadByte();
                        ptr->Y = reader.ReadByte();
                        ptr->Z = reader.ReadSByte();
                        ptr->Hue = reader.ReadInt16();
                    }
                }

                if (_lists == null)
                {
                    _lists = new HuedTileList[8][];

                    for (int i = 0; i < 8; ++i)
                    {
                        _lists[i] = new HuedTileList[8];

                        for (int j = 0; j < 8; ++j)
                            _lists[i][j] = new HuedTileList();
                    }
                }

                HuedTileList[][] lists = _lists;

                StaticTile* pCur = pTiles, pEnd = pTiles + count;

                while (pCur < pEnd)
                {
                    lists[pCur->X & 0x7][pCur->Y & 0x7].Add((short)((pCur->ID & 0x3FFF) + 0x4000), pCur->Hue, pCur->Z);
                    ++pCur;
                }

                HuedTile[][][] tiles = new HuedTile[8][][];

                for (int i = 0; i < 8; ++i)
                {
                    tiles[i] = new HuedTile[8][];

                    for (int j = 0; j < 8; ++j)
                        tiles[i][j] = lists[i][j].ToArray();
                }

                return tiles;
            }
        }