SkyAndEmittedLightAPI

Discussion in 'Bukkit Preview' started by Mike Primm, Jan 18, 2012.

  1. Offline

    Mike Primm

    This API enhancement allows plugins to access the lower level components that support the calculation of the light level of a block. Specifically, these are the emitted light level (the light received in the block from light emitting sources, like torches, glowstone, or lava) and the sky light level (corresponding to the light received by the block during full daylight). In both cases, the range is from 0 to 15. Both values are constant until a world data change occurs (unlike the light level, which is also a function of the time of day and weather). Mathematically, the relationship between the values is:

    LightLevel = max (EmittedLightLevel, (AmbientLightLevel - (15 - SkyLightLevel)))

    Where AmbientLightLevel corresponds to the time-of-day and weather sensitive ambient light (15 for full daylight, 4 for moonlight, 7 during daytime thunderstorms, etc).

    The two components can be useful for a variety of purposes, ranging from emulating the client graphics (which show emitted light with a reddish tint, while day and moon light has a blue tint), predicting future light levels, approximating proximity to light sources (emitted-light), or approximating how "under cover" or "shadowed" a location is (sky-light).
     
    emericask8ur likes this.

Share This Page