private byte SetLightLevel(Level level, Queue <BlockCoordinates> lightBfsQueue, BlockCoordinates coordinates, byte lightLevel, bool down = false, bool up = false) { if (_trackResults) { MakeVisit(coordinates); } if (!down && !up && coordinates.Y >= level.GetHeight(coordinates)) { level.SetSkyLight(coordinates, 15); return(15); } bool isTransparent = level.IsTransparent(coordinates); byte skyLight = level.GetSkyLight(coordinates); if (down && isTransparent && lightLevel == 15) { if (skyLight != 15) { level.SetSkyLight(coordinates, 15); } /*if (!lightBfsQueue.Contains(coordinates)) */ lightBfsQueue.Enqueue(coordinates); return(15); } if (isTransparent && skyLight + 2 <= lightLevel) { byte newLevel = (byte)(lightLevel - 1); level.SetSkyLight(coordinates, newLevel); /*if (!lightBfsQueue.Contains(coordinates)) */ lightBfsQueue.Enqueue(coordinates); return(newLevel); } return(skyLight); }