====== Lighting Engine ======
The server needs to calculate lighting (that is, both skylight and block light), because the light arrays are sent to the client with each chunk (the client then updates the lighting locally), and because light is used for secondary purposes, such as mob spawning or certain block placement (mushrooms).

Light is always calculated for an entire one chunk at once. This makes the algorithm easier to implement and faster, too. Because light can spread across chunk boundaries and back, chunks neighboring with the calculated chunk must be present for the calculation. This takes up about 1.7 MiB of memory.

To calculate light, first the light sources are identified. These are called "seeds", light will propagate from them in all directions. For blocklight, seeds correspond to the blocks that emit light. For skylight, seeds must be calculated based on the heightmap. After the seeds have been marked, each seed is iterated over and light is spread from it one-block-far in all available directions. If the light value in the destination block has been lower, this means an increase in the light value, so that block's neighbors need to be recalculated again. Therefore the block is stored as a new seed. The algorithm repeats this until there are no more seeds left.

For this algorithm to run fast, it needs proper handling of the seeds "list. It needs to be able to add a seed to the "list" quickly, and it needs to be able to check whether a block is in the seed list fast. For this reason, each seed is stored twice. Once in an array that holds seed coordinates (encoded as a single int) and is added-to sequentially, and secondly in an array of booleans that indicate whether a block at the coords which correspond to the array index is a seed or not.

The algorithm requires two such structures of seeds, one for the current stage (seeds being processed) and one for the next stage (seeds being generated). This takes up an additional 5.7 MiB of memory, making the Lighting engine the algorithm with the most memory consumed.