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

Running a set_attributes function throws java.lang.NullPointerException if it contains an undefined attribute

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 20w16a
    • 20w14a, 20w15a
    • Plausible
    • Crash
    • Important

      The bug

      If a set_attributes function contains an undefined attribute, the item stack will try to put null to tag.AttributeName and throws java.lang.NullPointerException.

      How to reproduce

      1. /loot give @s loot mc-177253:test

        An unexpected error occurred trying to execute that command (java.lang.NullPointerException)

      • data/mc-177253/loot_tables/test.json
        {
          "type": "minecraft:generic",
          "pools": [
            {
              "rolls": 1,
              "entries": [
                {
                  "type": "minecraft:item",
                  "name": "minecraft:stone",
                  "functions": [
                    {
                      "function": "minecraft:set_attributes",
                      "modifiers": [
                        {
                          "name": "mc-177253",
                          "attribute": "mc-177253:undefined",
                          "operation": "addition",
                          "amount": 0.0,
                          "slot": "mainhand"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }

            boq [Mojang] Bartosz Bok
            intsuc intsuc
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: