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

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 20w14a, 20w15a
    • Fix Version/s: 20w16a
    • Labels:
    • Confirmation Status:
      Plausible
    • Category:
      Crash
    • Mojang Priority:
      Important

      Description

      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"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                CHK: