Mojira Archive
MC-169916

Predicate testing light levels 0-4 are treated as one light level.

Light levels 0-4 are treated as one light level, so it is impossible to differentiate between those five values. For example, when trying to detect a light level specifically of 4, any actual light level of 0, 1, 2, 3, or 4 will return as true.

Worse when trying to detect only a value of 0, which will return false even if the light is actually 0! It is thus impossible to detect absolute darkness of 0, which is what I was trying to do when I discovered this bug.

Only values above 5 can be successfully specifically tested for.

Predicate gatkong:dark

{
  "condition": "minecraft:entity_properties",
  "entity": "this",
  "predicate": {
    "location": {
      "light": {
        "light": 0
      }
    }
  }
}

execute at @s if predicate gatkong:dark run say dark

edit to add: It appears this is only true on the surface (exposed to sky). Underground (no visible sky) one can accurately detect darkness of 0 etc.

edit #2: It appears night darkness exposed to sky displays in f3 as (12 sky, 0 block) but predicate tests as 4.

Invalid

Scott Miller

2020-01-16, 05:49 AM

2020-01-17, 03:59 AM

2020-01-16, 06:18 AM

0

0

Unconfirmed

(Unassigned)

1.15.1

-