Ejemplo n.º 1
0
        private void SpreadBlockLightInternal(int x, int y, int z, int dist = 0)
        {
            if (dist > 0xf)
            {
                return;
            }
            Chunk chunk     = Chunk.GetChunk(x >> 4, z >> 4, this);
            var   currLight = chunk.GetBlockLight(x & 0xf, y, z & 0xf);

            if (currLight == 0)
            {
                return;
            }

            ForEveryAdjacentBlock(x, y, z, delegate(int xx, int yy, int zz)
            {
                var type  = chunk.SGB(xx & 0xf, yy, zz & 0xf);
                var light = chunk.GetBlockLight(xx & 0xf, yy, zz & 0xf);
                if (Chunk.LightOpacity[type] == 0 && light < currLight - 1)
                {
                    chunk.SetBlockLight(xx & 0xf, yy, zz & 0xf, (byte)(currLight - 1));
                    SpreadBlockLightInternal(xx, yy, zz, dist + 1);
                }
            });
        }