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

Using "slot" in minecraft:attributes effect component doesn't actually restrict slot

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.21.1, 24w39a
    • None
    • Confirmed
    • Data Packs, Enchantments
    • Low
    • Platform

      Creating a custom enchantment that modifies generic.armor should be restricted by slot, e.g. chest, but still works even when equipped to a different slot, e.g. feet.

              "minecraft:attributes": [
                  {
                      "amount": {
                          "type": "minecraft:linear",
                          "base": 1.0,
                          "per_level_above_first": 1.0
                      },
                      "attribute": "minecraft:generic.armor",
                      "id": "ifiht:enchantment.solar_aegis",
                      "operation": "add_value",
                      "slot": "chest"
                  }
              ] 

      working test datapack zip attached.

      How to reproduce:

      1. Join a new world with the attached data pack enabled.
      2. Execute the following command:
        /give @s golden_boots[enchantments={levels:{'ifiht:solar_aegis':1}}]
      3. Equip the boots you were given.

      Expected result:

      Golden boots with the enchantment would only provide +1 armor total, since the enchantment only affects items worn in the chest slot.

      Observed result:

      Golden boots with the enchantment add a total of +2 armor points to the player, even though the enchantment only applies the generic.armor boost to the chest slot.

            Unassigned Unassigned
            ifiht ifiht
            Votes:
            5 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: