Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-169916

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 1.15.1
    • None
    • Unconfirmed
    • (Unassigned)

      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.

            Unassigned Unassigned
            Gatinh0 Scott Miller
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: