Yes you got it wrong
I'll try to be more clear :
For each block in the world, you have two lighting values :
- sunlight (call it 'sunlight'), from 0 to 255, tells you how much of the sunlight reaches this block
- and block light (call it 'light'), from 0 to 255, tells you how much light comes to this block from torches or local light sources
These two values have to be calculated in the CPU using some spreading algorithm, and stored in memory, every time a light moves or a block is destroyed/created.
The first approach I used (and so did Notch), was to use these two values to compute a "final light color", and store it in the vertex data.
The big problem comes when the sun color changes, when going from day to night for example : you have to re-update all your vertex caches to use the new sun color. And this is costly (only if you use a vertex caching mechanism though, like VBOs. If you render the world in immediate mode then it makes almost no difference).
So the trick is :
When you want to render your block, you create a vertex list, and to each vertex from that block, you associate two additional texture coordinates : (sunlight, light).
In the shader, you use these coordinates to sample a "lighting texture". In pseudo code, if the lighting texture is called 'texture', you have :
texture[sunlight][light]
... which is the resulting light value of your vertex (the "final light color" I was reffering to earlier).
Actually, you can do it without a light texture, and do all the calculations in the fragment shader. The texture is just a cache that contains already calculated values, that you built in the CPU before.
Edit : I've submitted a new commit to the SVN repository. You can now change the color of the sky and sunlight for the different times of the day. Here is a sample screenshot of the game at night with the modified colors :
Contrary to what one could think, the sun color at night is plain black. The blueish tint comes from the contrast with the warm color of the torch light down the cave.