OpenMinecraft.ShittyLighter.DoSkylighting C# (CSharp) Method

DoSkylighting() private method

private DoSkylighting ( Chunk c ) : void
c Chunk
return void
        private void DoSkylighting(Chunk c)
        {
            int csx = (int)c.Size.X;
            int csz = (int)c.Size.Y;
            for (int _x = 0; _x < csx; _x++)
            {
                for (int _z = 0; _z < csz; _z++)
                {
                    int x = (int)(c.Position.X * csx) + _x;
                    int z = (int)(c.Position.Y * csz) + _z;
                    for (int y = 0; y < c.HeightMap[x, z]; y++)
                    {
                        byte currentSkyLight = c.SkyLight[x,y,z];

                        byte currentBlock = c.Blocks[x, y, z];

                        Block currentBlockInfo = OpenMinecraft.Blocks.Get(currentBlock);

                        // SUNLIGHT
                        currentSkyLight = (byte)(currentSkyLight - currentBlockInfo.Stop - 1);

                        if (currentSkyLight < 0) currentSkyLight = 0;
                        if (currentSkyLight > 15) currentSkyLight = 15;

                        c.SkyLight[x, y, z]=currentSkyLight;
                    }
                }
            }
            c.Save();
        }