Example #1
0
        public ChunkSection(ChunkColumn owner, int y, bool storeSkylight, int sections = 2)
        {
            Owner = owner;
            if (sections <= 0)
            {
                sections = 1;
            }

            this._yBase = y;
            //Data = new BlockStorage();
            _blockStorages = new BlockStorage[sections];
            for (int i = 0; i < sections; i++)
            {
                _blockStorages[i] = new BlockStorage();
            }

            this.BlockLight = new NibbleArray(ArrayPool <byte> .Shared.Rent(2048));
            MiNET.Worlds.ChunkColumn.Fill <byte>(BlockLight.Data, 0);

            if (storeSkylight)
            {
                this.SkyLight = new NibbleArray(ArrayPool <byte> .Shared.Rent(2048));
                MiNET.Worlds.ChunkColumn.Fill <byte>(SkyLight.Data, 0xff);
            }
//System.Collections.BitArray a = new System.Collections.BitArray(new byte[(16 * 16 * 16) / 8]);

            TransparentBlocks          = new System.Collections.BitArray(new byte[(16 * 16 * 16) / 8]);
            SolidBlocks                = new System.Collections.BitArray(new byte[(16 * 16 * 16) / 8]);
            ScheduledUpdates           = new System.Collections.BitArray(new byte[(16 * 16 * 16) / 8]);
            ScheduledSkylightUpdates   = new System.Collections.BitArray(new byte[(16 * 16 * 16) / 8]);
            ScheduledBlocklightUpdates = new System.Collections.BitArray(new byte[(16 * 16 * 16) / 8]);
            RenderedBlocks             = new System.Collections.BitArray(new byte[(16 * 16 * 16) / 8]);

            for (int i = 0; i < TransparentBlocks.Length; i++)
            {
                TransparentBlocks[i] = true;
                SolidBlocks[i]       = false;
            }
        }
Example #2
0
        public ChunkSection(int y, bool storeSkylight)
        {
            this._yBase     = y;
            Data            = new BlockStorage();
            this.BlockLight = new NibbleArray(4096, 0);

            if (storeSkylight)
            {
                this.SkyLight = new NibbleArray(4096, 0xff);
            }

            TransparentBlocks        = new BitArray(new byte[(16 * 16 * 16) / 8]);
            SolidBlocks              = new BitArray(new byte[(16 * 16 * 16) / 8]);
            ScheduledUpdates         = new BitArray(new byte[(16 * 16 * 16) / 8]);
            ScheduledSkylightUpdates = new BitArray(new byte[(16 * 16 * 16) / 8]);
            RenderedBlocks           = new BitArray(new byte[(16 * 16 * 16) / 8]);

            for (int i = 0; i < TransparentBlocks.Length; i++)
            {
                TransparentBlocks[i] = true;
                SolidBlocks[i]       = false;
            }
        }