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

attribute modifiers with the same id behave unexpectedly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 24w40a
    • None
    • Unconfirmed
    • (Unassigned)

      When having two items with attribute modifiers that have the same id and apply to the same attribute but require different slots to activate, the game starts behaving in unexpected ways.

      Equipping both items in there respective slots only applies the modifier once (as expected.)

      Removing only one of these items also removes the modifier despite the other item still being equipped in the correct slot and theoretically applying the modifier (unexpected).

      I know that it is not intended to have two modifiers with the same id but it could actually be useful if this bug was fixed since it would then be possible to use an "or gate" for modifiers.
      You either have to wear this equipment in this slot or this equipment in this other slot to get the modifier but wearing both at the same time doesn't add to your attribute value again. This has good implications for datapack creation in my opinion.

      @Greymagic27
      How to reproduce:

      1. Use this command to give your self an item that applies a modifier when held in the mainhand:

      /give @p turtle_scute[attribute_modifiers=[{id:"armor_id",type:"minecraft:armor",amount:1,operation:"add_value",slot:"mainhand"}]] 1
      

      2. Use this command to give your self an item that applies a modifier with the same type and id but when on the players head:

      /give @p golden_helmet[attribute_modifiers=[{id:"armor_id",type:"minecraft:armor",amount:1,operation:"add_value",slot:"head"}]] 1
      

      3. Go into survival or adventure mode

      4. Make sure you are not holding the turtle scute in your mainhand

      5. Place the golden helmet on your head. You should now have one armor point.

      6. Take the turtle scute in your mainhand. You should still have one armor point as excpected.

      7. Scroll your hotbar so you are no longer holding the turtle scute.

      What should happen: You should still have 1 armor point since the helmet is still on your head and should apply the modifier.

      What actually happens: You will have 0 armor points since unselecting the turtle scute from your mainhand removed the modifier without checking for other items that should still apply it.

            Unassigned Unassigned
            Nuclearinferno Nuclearinferno
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: