Skip to main content

Brightness (Entity Condition Type)

Compares the brightness at the entity's eyes, which ranges from 0 to 1, with a number.

Type ID: apoli:brightness

Fields

FieldTypeDefaultDescription
comparisonComparisonrequiredHow the brightness is compared with compare_to.
compare_toFloatrequiredThe number the brightness is compared with.

How brightness is worked out

The game takes the light level of the block the eyes are in, which is the higher of its block light and sky light. It then works out brightness as brightness = ambientLight + (1 - ambientLight) * lightLevel / (60 - 3 * lightLevel), where ambientLight is the dimension's ambient light: 0 in the Overworld and the End, and 0.1 in the Nether. In the Overworld and the End, that comes down to brightness = lightLevel / (60 - 3 * lightLevel). The results are slightly off because of the imprecision of floating point maths.

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

Examples

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

This checks whether the brightness at the player's eyes is 0.5 or lower, which is a light level of 11 or below in any of the three vanilla dimensions.