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

the value of attributes is dependend on the order of modifiers

XMLWordPrintable

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

      In snapshot 24w09a item components where added. There is states that the attribute modifier operation type add_multiplied_total uses the calculated value of all previous modifiers for its operation. This is currently not testable since bug MC-277324 exists but if this behavior works as it is described by the update log of 24w09a the actual value of attributes depends on the order in which the modifiers are evaluated. This is a problem since it causes unexpected behavior in datapacks.

      When adding attribute modifiers to entities using commands the order in which these modifiers are added can vary based on the situation. Since this order is kept by the game, the calculation of the attribute value might appear to be random.

      How to fix:
      In my opinion it would be better if the game first evaluates all the modifiers using the operation type add_value. After that all modifiers of the type add_multiplied_base should be evaluated and last the game should evaluate all modifiers of the add_multiplied_total type. This change would ensure that the attribute value is always the same and the order doesn't matter. For optimization the modifiers could be grouped by there types in the NBT of entities and players instead of specifying the type individually for each modifier.

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

              Created:
              Updated: