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

Scaled "/attribute modifier value get" output is misleading

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 23w51b
    • None
    • Unconfirmed
    • Commands

      The bug

      The output of /attribute <entity> <attribute> modifier value get always outputs the unscaled value of the modifier, and makes no mention of the scale parameter, even if provided.
      If run inside an /execute store, the stored value is properly scaled.

      This is in contrast to /data get, where the command outputs the scale parameter (if supplied) and the scaled value.

      Expected result

      The command would mention the scale parameter and scaled modifier value, like /data get.

      Steps to reproduce

      1. Create a dummy modifier
        /attribute @s minecraft:generic.luck modifier add 01234567-89ab-cdef-0123-456789abcdef "Dummy modifier" 1 add
        
      2. Create an example objective and make it visible
        /scoreboard objectives add example dummy "Example"
        /scoreboard objectives setdisplay sidebar example
        
      3. Retrieve the modifier value, scale it by 5 and store it in the example objective
        /execute store result score @s example run attribute @s generic.luck modifier value get 01234567-89ab-cdef-0123-456789abcdef 5
        
        • Observe the unexpected output:
          Value of modifier 01234567-89ab-cdef-0123-456789abcdef on attribute Luck for entity [...] is 1.0
          
        • Meanwhile, the player's score has the correct value of 5.
      4. Repeat the above, but via /data get, and scale by 10.
        /execute store result score @s example run data get entity @s Attributes[{Name:"minecraft:generic.luck"}].Modifiers[0].Amount 10
        
        • Observe the correct output:
          Attributes[{Name:"minecraft:generic.luck"}].Modifiers[0].Amount on [...] after scale factor of 10.00 is 10
          
        • Meanwhile, the player's score is updated to 10, as expected.

            Unassigned Unassigned
            MxxHxx11 SnipUndercover
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: