Brightness (Entity Condition Type)

Checks the brightness level at the entity's eyes, which ranges from 0 to 1.

Checks the brightness level at the entity’s eyes, which ranges from 0 to 1.

Type ID: apoli:brightness

!!! note

To calculate brightness at the player’s eyes, the game first gathers the light level of the block the eyes are inside of. This light level is the highest between the block and sky light levels of the block. Then it calculates brightness with the following formula: brightness = ambientLight + (1 - ambientLight) * lightLevel / (60 - 3 * lightLevel), with ambientLight as the dimension’s ambient light, which is 0 in the overworld and the End, and 0.1 in the Nether. Thus the formula simplifies to brightness = lightLevel / (60 - 3 * lightLevel) for the overworld and the End. The calculated values, however, are slightly off due to the imprecision of floating point calculations.

Here’s a table of light levels to brightness levels:

Light level0123456789101112131415
Overworld brightness0.00.0175438620.037037040.058823530.083333340.111111110.142857150.179487180.222222250.27272730.333333340.407407430.500000060.61904760.777777731.0
Nether brightness0.10.115789470.133333340.152941180.175000010.20.228571440.261538480.30.345454570.40.46666670.55000010.65714280.799999951.0

Fields

FieldTypeDefaultDescription
comparisonComparisonDetermines how the calculated brightness value should be compared to the specified value.
compare_toFloatThe value at which the calculated brightness value will be compared to.

Examples

"condition": {
    "type": "apoli:brightness",
    "comparison": "<=",
    "compare_to": 0.5
}

This example will check if the brightness level at the player’s eyes is 0.5 or lower, which corresponds to a light level of 11 or below in any of the three default dimensions.